题目:
![](https://img2023.cnblogs.com/blog/2871529/202305/2871529-20230521171617020-1223224332.png)
class IntegerReverseOrder{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int number = input.nextInt();
String s = String.valueOf(number); // int整数 变成 String字符串
int[] intArray = new int[s.length()];
int[] newArray = new int[s.length()];
for (int i = 0; i < s.length(); i++) {
intArray[i] = Integer.parseInt(String.valueOf(s.charAt(i)));
}
inversionArray(intArray,newArray);
//System.out.println(Arrays.toString(newArray));
String[] stringArray = new String[newArray.length]; //String字符串
for (int i = 0; i < newArray.length; i++) {
stringArray[i] = Integer.toString(newArray[i]);
}
String result = "";
//System.out.println(Arrays.toString(stringArray));
for (int i = 0; i < stringArray.length; i++) {
result += stringArray[i];
}
System.out.println(result);
input.close();
}
//int数组反转
public static void inversionArray(int[] l_old, int[] l_new) {
int length = l_old.length;//获得"原数组"的长度
for (int i = 0; i < l_old.length; i++) {
l_new[length - 1] = l_old[i]; //新数组的最后一个 == 原数组第一个
length--;
}
}
}