In fact this is a very common way of getting user to input numeric values. And if there is any elegant method to do this I would like to know.
First, you have to know if you are using the characters '0', '1', etc., or the numeric values 0, 1, etc.
'0' (with quotes) means the character '0', whereas
0 (without quotes) means the numeric value zero.
If you are using characters, first convert to numeric values. (You can convert characters '0' through '9' to their numeric values by subtracting '0'. So
'0' - '0' gives you
'1' - '0' gives you
Once you have the numeric values, use arithmetic to combine them. For example,
(3 * 10000) + (2 * 1000) + (7 * 100) + (6 * 10) + 8 = 32768
(9 * 10000) + (9 * 1000) + (9 * 100) + (9 * 10) + 9 = 99999
In code, I suggest you use
1000L, etc., because the
L forces the use of
long integers, which you will need if you are going all the way to 99999.
How to insert the decimal point? Again: arithmetic! Just divide by
100.0 (you will want the decimal point there as well).