Java编程:判断是否是回文数

import javax.swing.JOptionPane;

自然数中还有一类数被称为回文数。回文数就是一个数的两边对称,如11,121,1221,9339,30203等等


public class CircleTest{


 public static void main(String[] args){


  String inputValue = JOptionPane.showInputDialog("请输入一个整数");


  StringBuffer source = new StringBuffer(inputValue);


  source.reverse();


  String reverseString = new String(source);


  if(reverseString.equals(inputValue)){


   System.out.println("你输入的是回文数");


  }else{


   System.out.println("你输入的不是回文数");


  }


 }


}

posted @ 2014-06-16 21:29  心若向阳,何惧忧伤  阅读(1001)  评论(0编辑  收藏  举报