java - How to decode the value encoded as one*100 + two*10 + three? -


how values one, two , three back? following approach correct? looks no.

int encodedvalue = one*100 + two*10 + three;  // following decryption part of procedure int 1 = encodedvalue / 100; int 2 = encodedvalue / 10; int 3 = encodedvalue % 10;  

assuming two , three in range 0-9 (otherwise have ambiguity) want:

int 2 = (encodedvalue / 10) % 10; 

... otherwise gets ten times one value added it.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -