What do you mean by "not working"? What happens when you press the memory button? Does your app throw an exception? Does the "memory" contain the wrong value? Or does something else happen that is unexpected? Please give us more details about what happens and we can help you out.
With that said,
you should add some System.out.println() calls (or find some other way) to display the values of the variables involved. This will often help you see what is happening in your code.
Layne