思路:
比如 n =1234;
那么如何获取4,应该 n%10;
那么如何获取3,获取3之前应该删除4,所以n/10;
//40 +3 =43
//43*10 = 430>430+2(432)>432*10(4320)+1
r=0
怎么获取40:r *10 +d
看代码:
1 public class test2 { 2 public static void main(String[] args) { 3 int r = 0; 4 int input =1234; 5 int n =input %10; 6 input = input / 10; 7 r= r *10 +n; 8 System.out.println(r); 9 System.out.println(input); 10 n = input %10; 11 input = input / 10; 12 r =r *10 +n; 13 System.out.println(r); 14 System.out.println(input); 15 n = input %10; 16 input = input /10; 17 System.out.println(n); 18 System.out.println(input); 19 } 20 }
完整代码:
public static void number_1( int number){ int r =0; int o = number; while (number!=0){ int n =number %10; number =number /10; r = r *10 + n; } boolean is = (r ==0 *2); System.out.println(is); }
标签:返回,10,false,数字,int,System,number,input,out From: https://www.cnblogs.com/Gaze/p/18234069