Java tutorial
public class Main { public static void main(String[] argv) throws Exception { String s1 = "s1", s3 = "s3"; int i = s1.compareToIgnoreCase(s3); // -1 if (i < 0) { System.out.println("s1 precedes s3"); } else if (i > 0) { System.out.println("s1 follows s3"); } else { System.out.println("s1 equals s3"); } } }