Java 2 8 10 16

Source: Internet
Author: User

An integer literal is expressed in decimal (base), hexadecimal (base), octal (base 8) , or binary (base 2).

int decimal = ten;         int hexadecimal = 0x10;         int octal = 010;         = "Ten";        System.out.println (decimal);                        // Ten        SYSTEM.OUT.PRINTLN (hexadecimal);                  //  -        System.out.println (octal);                       // 8        // 2

Hex starts with 0x

Octal starts with 0

No binary numbers

Values are represented in 10 binary

How hexadecimal numbers are read

0 1 2 3 4 5 6 7 8 9 A B C D E F

Sample 1

0X10 read as a zero fork 10, can not be read as a zero fork 10 (decimal notation can not be applied to hexadecimal causes confusion); cannot be read as a zero Fork 16 (16 is its corresponding 10 binary value)

Sample 2

16 binary 11 means decimal is 17.

A hexadecimal representation of a decimal is 17.

The easy-to-understand system is decimal, which is used in decimal notation.

Java 2 8 10 16

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.