Symmetrical

/ ** 
* Analysis of the following requirements,
* defined number string array { "010", "3223", "666", "7890987", "123123"}
* determines the number string numeric string array is symmetric if
* (the first digit and the last digit is equal to the reciprocal of the second number and the second number is equal, and so on)
* (3): 010 is symmetric, 3223 is symmetrical, not symmetrical 123123
*
* /
public class TEST07 {
public static void main (String [] args) {
String ARR [] = { "010", "3223", "666", "7,890,987", "123123"};
for (int I = 0 ; I <arr.length; I ++) {
String ARR = S [I];
the StringBuilder the StringBuilder new new SB = (S);
the StringBuilder sb.reverse = Reverse ();
String S1 = reverse.toString ();
IF (S1.the equals (S)) {
System.out.println (S + "symmetric");
the else {}
System.out.println (S + "is not symmetrical");
}
}
}
}

Guess you like

Origin www.cnblogs.com/YRSWBY2016/p/12017118.html