diff --git a/java/src/main/java/com/google/openlocationcode/OpenLocationCode.java b/java/src/main/java/com/google/openlocationcode/OpenLocationCode.java index 7881ec87..85a2519b 100644 --- a/java/src/main/java/com/google/openlocationcode/OpenLocationCode.java +++ b/java/src/main/java/com/google/openlocationcode/OpenLocationCode.java @@ -188,7 +188,7 @@ public OpenLocationCode(double latitude, double longitude, int codeLength) { // Limit the maximum number of digits in the code. codeLength = Math.min(codeLength, MAX_DIGIT_COUNT); // Check that the code length requested is valid. - if (codeLength < PAIR_CODE_LENGTH && codeLength % 2 == 1 || codeLength < 4) { + if (codeLength < 2) { throw new IllegalArgumentException("Illegal code length " + codeLength); } // Ensure that latitude and longitude are valid.