Home > Mobile >  What is longest data type in Android (Java) that I can use to store a value with decimals?
What is longest data type in Android (Java) that I can use to store a value with decimals?

Time:06-15

I am trying to make a calculator app in Android Studio and want to store the numerical value in a variable.

What is the longest data type in Java which can store the max amount of decimals and what is its limit?

CodePudding user response:

looks like you need Big classes, like BigInteger and BigDecimal. also inspect other useful for your case classes extending Number:

AtomicInteger, AtomicLong, BigDecimal, BigInteger, Byte, Double, DoubleAccumulator, DoubleAdder, Float, Half, Integer, Long, LongAccumulator, LongAdder, Rational, Short

question about max size of these "Bigs" is answered HERE

  • Related