Wouldn't it be simpler to require 3 digits always? And more predictable? You can rely on `Integer.parseInt` to do the octal digit checking