• Byte:

    Size: 1 byte

    The value ranges from -128 to 127

  • Short:

    Size: 2 bytes

    Range: -2^15 to 2^15-1

  • Int: Size: 4 bytes

    Range: -2^31 to 2^31-1

  • Long: Size: 8 bytes

    Range: -2^63 to 2^63-1

  • Float: Size: 4 bytes

    Range: -2^63 to 2^63-1

  • double

    Size: 8 bytes

  • Char:

    Size: 2 bytes

    Range: \u000 ~ \ uFFF

  • boolean

    Size: 4 bytes alone, 1 byte in the array

    The reason is described in the Java Virtual Machine Specification: “The Boolean data type is defined, but only very limited support is provided for it. There are no special bytecode instructions for Boolean values in the Java Virtual machine. Boolean values operated on by Java language expressions are replaced by Java VIRTUAL machine int data types after compilation. Boolean arrays are encoded as Java virtual machine byte arrays. Each element Boolean element takes 8 bits “.