Getting a 4-digit number from a keypad

Hello,
MarkT:
Not really, It waits till the fourth key to be pressed before showing the result.

for (int i = 0; i < 4;){
               if(keypad.getKey()!= NO_KEY){                
               int tmp = keypad.getKey();
                          int getKey(tmp);
                          myNum[i]= tmp;
                          i = i+1;

Waits till i=3 (0, 1, 2, 3) before continuing

PaulS:
Is not a password, I want the number as a real int number, that's why at the last lines I count for "total"...
Backspace and enter (confirmation) will be next step to be done, but first I want to get the number (don't want to run before knowing how to walk...).
And is supposed the program is inside "for (int i = 0; i < 4;)" till gets four keys pressed.

Thanks for the replies, but I think is not the problem.

Cheers!!