Is there a datatype in Java that stores a decimal number more precisely than a double
?
Depends on the range of your input. Many times, you can just use int or long. For money, just store the integer number of pennies. int will handle up to $20,000,000.00 which is large enough for my bank account. long goes far higher.
If your range is suitable, using long is much faster and cleaner than using BigDecimal