/**
 * Demonstration of what the compareTo method returns
 *
  * @author TK Rogers
 * @version 1-23-2011
 */
public class CompareToIgnoreCaseDemo {
    public static void main ( String s1, String s2 ) {
        boolean foundDifference = false ;
        if ( s1.length ( ) <= s2.length ( ) ) {
            for ( int x = 0 ; x < s1.length ( ) ; x++ ) {
                if ( ((s1.charAt ( x ) - s2.charAt ( x ) )) != 0 ) {
                    System.out.println ( "The first difference is at position " + x + " and = " + ( s1.charAt ( x ) - s2.charAt ( x ) ) ) ;
                    foundDifference = true ;
                    break ;
                }
            }
        } else {
             for ( int x = 0 ; x < s2.length ( ) ; x++ ) {
                if ( ( s1.charAt ( x ) - s2.charAt ( x ) ) != 0 ) {
                    System.out.println ( "The first difference is at position " + x + " and = " + (s1.charAt ( x ) - s2.charAt ( x ) ) ) ;
                    foundDifference = true ;
                    break ;
                }
            }
        }
        if (!foundDifference) {
            System.out.println ("s1 is " + ( s1.length ( ) - s2.length ( ) ) + " char longer than s2 " ) ;
        }
        System.out.println ( "s1.compareTo ( s2 ) returns " + s1.compareTo ( s2 ) ) ; 
    }
}