i have a problem with one task in Java. I have text file with these numbers –
input : 000000004599
000000001000
And the result should be –
output: 45.99
10.00
sum of two varriables – 5599 (yes,without "dot")
I only have guesses that it is necessary to remove numbers from the beginning through the array.
Example :
if (arr[i] = 0 && arr[i + 1] = 0) {
…
}
I’m sure there is another logical solution
>Solution :
You can simply use Integer.parseInt.
Integer.parseInt("000000004599") + Integer.parseInt("000000001000"); // 5599