Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String from(String zipCode) {
- if (zipCode.length() != 5) {
- throw new InvalidZipCodeException();
- }
- try {
- int parsedZip = Integer.parseInt(zipCode);
- } catch (NumberFormatException numberException) {
- throw new InvalidZipCodeException();
- }
- return zipCode;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement