Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. public static String from(String zipCode) {
  2. if (zipCode.length() != 5) {
  3. throw new InvalidZipCodeException();
  4. }
  5. try {
  6. int parsedZip = Integer.parseInt(zipCode);
  7. } catch (NumberFormatException numberException) {
  8. throw new InvalidZipCodeException();
  9. }
  10. return zipCode;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement