How can I get an answer like this?

• Input:
"2"

Output:
["a

Expected:
["a","b","c"]

and this is my code:

``````enter code here :  public List<String> letterCombinations(String digits) {
char[] min = new char[11];
char[] max = new char[11];
char[] t = new char[1000];
List l = new ArrayList<String>();
if (digits.length()==0) {
return l;
}
t = digits.toCharArray();
int n=digits.length();
char[] last = new char[1000], temp = new char[1000];
for(int i=2; i<=9; i++) {
min[i] = (char) ('a'+(i-2)*3);
max[i] = (char) ('c'+(i-2)*3);
}
for (int i=0; i<n; i++) {
temp[i] = min[t[i]-'0'];
last[i] = max[t[i]-'0'];
}
while (1 == 1) {
temp = getnext(temp,n,min,max,t);
if (String.valueOf(temp).equals(String.valueOf(last)))
break;
}
return l;
}
public char[] getnext(char[] a,int n, char[] min, char[] max, char[] t) {
int i=0;
for (i=n-1; i>=0; i--) {
if (a[i] < max[t[i]-'0']) {
a[i] = (char) (a[i]+1);
break;
} else
continue;
}
if (i != n-1)
for (int j=i+1; j<n; j++)
a[j] = min[t[j]-'0'];
return a;
}``````