public static int compareCanonicalIntegers(String int1,String int2){
  if (int1.equals(int2)) {
    return 0;
  }
  if (int1.charAt(0) == '-' && int2.charAt(0) != '-') {
    return -1;
  }
  if (int2.charAt(0) == '-' && int1.charAt(0) != '-') {
    return 1;
  }
  int result=int1.length() - int2.length();
  if (result == 0) {
    for (int i=0; result == 0 && i < int1.length(); i++) {
      result=int1.charAt(i) - int2.charAt(i);
    }
  }
  if (int1.charAt(0) == '-') {
    result=-result;
  }
  return result;
}

public static int compareCanonicalIntegers ( String int1 , String int2 ) { if ( int1 . equals ( int2 ) ) { return 0 ; } if ( int1 . charAt ( 0 ) == '-' && int2 . charAt ( 0 ) != '-' ) { return - 1 ; } if ( int2 . charAt ( 0 ) == '-' && int1 . charAt ( 0 ) != '-' ) { return 1 ; } int result = int1 . length ( ) - int2 . length ( ) ; if ( result == 0 ) { for ( int i = 0 ; result == 0 && i < int1 . length ( ) ; i ++ ) { result = int1 . charAt ( i ) - int2 . charAt ( i ) ; } } if ( int1 . charAt ( 0 ) == '-' ) { result = - result ; } return result ; }
compares two canonical integers to eachother .
