public static void main(String[] args) {
String str = "12345678900546460000146106561";
int index = 2;
String s = str.substring(index, index + 1);
if (s.equals("0")) {
System.out.println(s);
} else if (s.equals("1")) {
System.out.println(s);
} else {
System.out.println(index + "下标上既不是0也不是1 为" + s);
}
} |