Form least lexicographical String
return String . valueOf ( ( x + y ) . compareTo ( y + x ) ) ; } static boolean areEquivalent ( String a , String b ) { return ! ( leastLexiString ( a ) . equals ( leastLexiString ( b ) ) ) ; }