Value range and storage requirements of basic data types in Java

Source: Internet
Author: User

 

Value range and storage requirements of basic data types in Java

Type Value Range Storage Requirements Remarks
Byte -128 to 127 1 byte -27 to 27-1
Short -32 768 to 32 767 2 bytes -215 to 215-1
Int -2 147 483 648 to 2 147 483 647 4 bytes -231 to 231-1
Long -9 223 372 036 854 775 808 to 9 223 372 036 854 775 807 8 bytes -263 to 263-1
Float About ± 3. 402 823 47E + 38f (6 to 7 digits) 4 bytes E + 38 indicates that the value is multiplied by the power 38 of 10, and F indicates that the value is of the float type.
Double About ± 1. 797 693 134 862 315 70e + 308 (15 digits valid) 8 bytes  
Char 0 to 65535 2 bytes 65536
Boolean True or false 1 byte It occupies 1/8 bytes, that is, 1 bit. However, its size is not explicitly specified.

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.