Java - Number

About

Number, Numeric, Quantity in Java.

The abstract class Number is the superclass of platform classes representing numeric values that are convertible to the primitive types byte, double, float, int, long, and short.

List

Floating point

Number - Floating-point (system|notation) - (Float|Double) - Approximate numeric

The literal n.n is interpreted as a double.

double = 3.6

Integer

Fixed point

fixed point number (ie exact calculation) in java is implemented with the BigDecimal data type

  • Bigger than and bigger or equal
value.compareTo(BigDecimal.valueOf(10)) > 0
value.compareTo(BigDecimal.valueOf(10)) >= 0
  • Less Than and less than or equal
value.compareTo(BigDecimal.valueOf(10)) < 0
value.compareTo(BigDecimal.valueOf(10)) <= 0

Documentation / Reference


Powered by ComboStrap