Determine whether it is a palindrome

public static void main(String[] args) {
	String inputValue = JOptionPane.showInputDialog("Please enter an integer");
	  long inputValueLong = Long.parseLong(inputValue);
	  long temp = inputValueLong;
	  long reverseLong = 0L;
	  while(inputValueLong != 0)
	  {
	   reverseLong = reverseLong*10+inputValueLong%10;
	   inputValueLong = inputValueLong/10;
	  }
	  if(reverseLong == temp)
	   System.out.println("You entered a palindrome");
	  else
	   System.out.println("You did not enter a palindrome");
	 
}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326783794&siteId=291194637