如题,例如:输入1000235,输出5320001;输入7654321,输出1234567;
public class convert { public static void main(String args[]) { int num = (int)(Math.random() * 1000000); int tmp = 0; int rs = 0; System.out.println("num = " + num); while (num > 0) { tmp = num % 10; num = num / 10; rs = rs * 10 +tmp; } System.out.println("rs = " + rs); } }
原文链接:https://www.f2er.com/javaschema/284888.html