Fix java encoding to accept codeLength of 2 and add test cases
The encoding of codes with length 2 should be allowed as specified, but the Java implementation unnecessarily limits the codeLength to a minimum length of 4 by mistake.
This bug was originally discovered by @brewmanz in the C# implementation, which inherited this bug from the Java implementation since day 1. See discussion in issue https://github.com/google/open-location-code/issues/360#issuecomment-527561196
It appears that the encoding tests in most implementations do not account for expected encoding failures like the test_data/encoding.csv specifies:
expected code (empty if the input should cause an error)
https://github.com/google/open-location-code/blob/master/test_data/encoding.csv#L6 So we will need to update the tests to support expected encoding failures.