By default in java, any number with a decimal in it is considered/read/treated as a
double data type. To get this into a
long data type you would have to cast it to a
long. But then you won't get it to print out as a
double, ie, with two decimal places.
public class Test {
public static void main(String[] args) {
String stotal = "99998900001.00";
// NumberFormatException
// long error = Long.parseLong(stotal);
double okay = Double.parseDouble(stotal);
System.out.printf("okay = %.2f%n", okay);
long toLong = (long)okay;
long again = Double.valueOf(stotal).longValue();
System.out.printf("toLong = %d again = %d%n",
toLong, again);
}
}