I'm writing a Telephone class and it has a method called getDigits which takes in a String parameter and returns the number that would appear on your phone if you typed in those letters the old fashioned way.Example: Typing in CAT would return 228.I wrote the following code and it works but I wanted to know if anyone else out there had better ideas to do it/ more sophisticated ones. I'm learning about data abstraction/enums and maybe that's a clue to how my professor wanted me to approach this but I'm stumped.public int getDigits(String test){        String result = ;        String param = test.toUpperCase();        for(int i = 0; i<param.length(); i++){            String s = Character.toString(param.charAt(i));            if(s.equals(A) || s.equals(B) || s.equals(C)){                result += 2;            }            else if(s.equals(D) || s.equals(E) || s.equals(F)){                result += 3;            }            else if(s.equals(G) || s.equals(H) || s.equals(I)){                result += 4;            }            else if(s.equals(J) || s.equals(K) || s.equals(L)){                result += 5;            }            else if(s.equals(M) || s.equals(N) || s.equals(O)){                result += 6;            }            else if(s.equals(P) || s.equals(Q) || s.equals(R) || s.equals(S)){                result += 7;            }            else if(s.equals(T) || s.equals(U) || s.equals(V)){                result += 8;            }            else if(s.equals(W) || s.equals(X) || s.equals(Y) || s.equals(Z)){                result += 9;            }        }        return Integer.parseInt(result);    }
Creating a numeric phone keypad
java;beginner;strings;converting