Introduction to basic data types related to Oracle Java

Source: Internet
Author: User

We all know that the basic data types related to Oracle Java are unsigned. The basic data types related to java are unsigned and unsigned, therefore, their related values are fixed and will not change as the hardware environment or operating system of the machine changes.

Oracle Java simple data type

Simple type size range/precision

Float 4-byte 32-bit IEEE 754 single precision

Double 8-byte 64-bit IEEE 754 dual precision

Byte 1 byte-128 to 127

Short 2 bytes-32,768 to 32,767

Int 4-2,147,483,648 to 2,147,483,647

Long 8 bytes-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807

Char 2-byte full Unicode Character Set

Boolean 1-bit True or false

1 byte is fixed by 8-bit binary

For example, if the byte range is-128 to 127, what should you do if you want to change it to 0 to 255? Just perform operations with 0XFF.

For example, if you want to assign a value of 255 to byte bb, that is not acceptable. Even if the value is assigned, the value of bb is also the value of-1 after the 255-to-256 modulo.

If you just want to get the value from 0 to 255, it's very easy,

Bb & 0XFF, for example, bb =-1, the bb & 0XFF result is 255,

The operation result is implicitly converted to the int type because the bytes cannot be placed.

It is faster than addition and subtraction.

The above content is an unsigned introduction to the basic data type of Oracle Java. I hope you will get some benefits.

Related Article

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.