how does it not work? does it break on compile? where does it break?
Looks to me like your numbers are going into the array correctly but your comarison is off.
You need to compare 012 then 023 then 034 then 123 then 134, etc.
Probably need a nested for loop for that.
for (int i = 0; i <= 2; i++){
for (int k = 1; k <= 3; k++){
...etc...