Storing numbers and recalling numbers ?

Storing numbers and recalling Question

Lets say you've entered a value displays the output i.e

String s;

float A;

double Number;

s=TextFieldValueA.getText();

A=Integer.parseInt(s);

Number= (double)Math.round(A);

s=String.valueOf(Number);

txtNumber.setText(s);

now when you select store on the menu it stores the number

"ValueOf(Number)" and TextField A just like when you click store buttton on a calcutor M+ and M- to recall that number

and

to recall the Stored Values to be displayed on the textfields Number and A

when recall is selected this can be done in Pascal when programming your calculator like the TI 84 Silver

i.e 1-(sto)-> A A= 1 rcl A, A=1

ive tried the stack method of push pop etc no success in achieving if theres a simple method your help would be appreciated on this one

Thanks >>>>>>>>