Check order of two strings
public class Main { public static void main(String[] argv) throws Exception { String s1 = "s1"; String s2 = "s2"; int i = s1.compareTo(s2); // 32; lowercase follows uppercase if (i < 0) { // s1 precedes s2 } else if (i > 0) { // s1 follows s2 } else { // s1 equals s2 } } }