Range of values for short, int, long, float, double in Java

Source: Internet
Author: User


First, the characteristics of the basic data type, number of digits, maximum and minimum values.
1.
Basic type: Short bits number: 16
Packing type: Java.lang.Short
Minimum value: short.min_value=-32768 (-2 of 15 this party)
Maximum value: short.max_value=32767 (2 of 15 square-1)
2.
Base type: int bits number: 32
Packing type: Java.lang.Integer
Minimum value: integer.min_value=-2147483648 (-2 of 31 squares)
Maximum value: integer.max_value= 2147483647 (2 of 31 square-1)
3.
Basic type: Long bits number: 64
Packing type: Java.lang.Long
Minimum value: long.min_value=-9223372036854775808 (-2 of 63 squares)
Maximum value: long.max_value=9223372036854775807 (2 of 63 square-1)
4.
Base type: Float bits number: 32
Packing type: java.lang.Float
Minimum value: float.min_value=1.4e-45 (2-149-square)
Maximum value: Float.max_value=3.4028235e38 (2 of 128 square-1)
5.
Basic type: Double bits number: 64
Packing type: java.lang.Double
Minimum value: double.min_value=4.9e-324 (2-1074-square)
Maximum value: double.max_value=1.7976931348623157e308 (2 of 1024 square-1)

Basic type Number of bytes Number of digits Maximum Value Minimum value
Byte 1byte 8bit 2^7-1 -2^7
Short 2byte 16bit 2^15-1 -2^15
Int 4byte 32bit 2^31-1 -2^31
Long 8byte 64bit 2^63-1 -2^63
Float 4byte 32bit 3.4028235E38 1.4E-45
Double 8byte 64bit 1.7976931348623157E308 4.9E-324
Char 2byte 16bit 2^16-1 0

Range of values for short, int, long, float, double in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.