标签:规律 als 重复 data 问题 valueof put arraylist java
1 import java.util.ArrayList; 2 import java.util.Arrays; 3 import java.util.Collections; 4 import java.util.List; 5 import java.util.Scanner; 6 7 class Main{ 8 static int sum; 9 public static void main(String[] args) { 10 Scanner input = new Scanner(System.in); 11 String temp = input.next(); 12 StringBuffer s = new StringBuffer(temp); 13 while(!s.toString().equals("6174")){ 14 char[] a = s.toString().toCharArray(); 15 Arrays.sort(a); 16 s = new StringBuffer(String.valueOf(a)); 17 int h = Integer.parseInt(s.reverse().toString())-Integer.parseInt(s.reverse().toString()); 18 s = new StringBuffer(h+""); 19 while(s.length()!=4){ 20 s.append("0"); 21 } 22 sum++; 23 } 24 System.out.println(sum); 25 26 } 27 }
标签:规律 als 重复 data 问题 valueof put arraylist java
原文地址:http://www.cnblogs.com/lolybj/p/6660391.html