Java basic data type constants, character constants

Source: Internet
Author: User

The representation of an integer constant: a binary representation (binary, octal, decimal, hexadecimal)

In life: Decimal (0-9), Week (Seven decimal (0-6)), Time (12 binary (0-11), 24 binary (0-23))

Computers are binary to read the data in our lives.

Conversions between the binaries:

Decimal to binary: divides the decimal by 2 until the quotient is 0, and the remainder is connected from the bottom to the binary.

Ten---->1010

Binary to decimal: multiplies each bit of the binary by 2^n, N starts at 0, N adds one each time, and adds the result.

1001----"1*2^0 +0*2^1 +0*2^2+1*2^3 = 9

Binary transposition octal:

Way 1:2 binary---> Decimal---> Octal

Mode two: An octal equivalent of three binary for, will be binary three bit a split, calculated

010 100 101 = 245

Change binary to 16: (0-9) (A ()-f (15))

0000 1010 0101 = A5

Java basic data type constants, character constants

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.