How does a.compareTo(b) works when it comes to Strings with numbers? Is it comparing only first digit (their unicode value) of the number and doesn't care about the rest (ie. not summing unicode value of each digit)? Because using the method isGreaterThan - "22" is not greater than "3" (while obviously integers 22 > 3). And passing ""22".compareTo("3") shows -1 (so I understand that their unicode value differs only by 1 even though 22 is two digit number).