public static boolean isLooped(int num) { StringBuilder strBuilder = new StringBuilder(String.valueOf(num)); int l = 0; //左指针 int r = strBuilder.length() - 1; //右指针 while (l < r) { if (strBuilder.charAt(l) != strBuilder.charAt(r)) { return false; } ++l; --r; } return true; }