Skip to main content

Java to converter

This is one of the best code converter tool which is capable to convert valid java code into ( code. It is working on different layers to convert the code like java method, some specific collection and syntax to


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment

Az     163 Day ago
// Java program to implement
// Luhn algorithm

class GFG {
// Returns true if given
// card number is valid
static boolean checkLuhn(String cardNo)
	int nDigits = cardNo.length();

	int nSum = 0;
	boolean isSecond = false;
	for (int i = nDigits - 1; i >= 0; i--)

		int d = cardNo.charAt(i) - '0';

		if (isSecond == true)
			d = d * 2;

		// We add two digits to handle
		// cases that make two digits
		// after doubling
		nSum += d / 10;
		nSum += d % 10;

		isSecond = !isSecond;
	return (nSum % 10 == 0);

	// Driver code
	static public void main (String[] args)
		String cardNo = "79927398713";
		if (checkLuhn(cardNo))
			System.out.println("This is a valid card");
			System.out.println("This is not a valid card");

// This Code is contributed by vt_m.
Ashwini Vaishya     182 Day ago
Hi Team,

On 9th of June 2022, I have uploaded a java script to connect to database.
Request you to kindly delete and acknowledge the same.