Big Data Java Foundation the next day

Source: Internet
Author: User
Tags logical operators

1. Manifestations and characteristics of various forms of production

For integers, there are four ways to represent

    • Binary: 0,1, full 2 in 1. Start with 0b or 0 B.
    • Decimal: 0-9, full 10 in 1
    • Octal: 0-7, full 8 in 1. Starting with the number 0
    • Hex: 0-9 and A-f, full 16 in 1. Starts with a 0x or 0X representation. The a-f here are case insensitive.

such as: 0x21af +1= 0x21b0

2. Conversion methods between the various systems

The binary is converted to decimal, and the book on each bit is multiplied by the power of 2 (right) in summation.

Decimal is converted to binary, the remainder is divided by a decimal number by 2, and the remainder is staggered.

Octal is converted to decimal, each integer multiplied by a power of 8, and then added.

Decimal is converted to octal, divided by 8 to take the remainder, then the flashback is arranged.

Binary to octal, starting from the low, every three binary number is a group, to the last insufficient to fill 0, each group replaced by the corresponding octal number.

octal into binary, each octal number is disassembled into three binary number of arrays, not enough to fill 0, and then connect the array.

Binary to 16 binary, each four bits is a group, get a hexadecimal number, and then sort from left to right.

hexadecimal to binary, the number of each hex is disassembled into four binary arrays, less than 0 to complement, and then connect the array.

The octal and hexadecimal conversions are converted into binary and other conversions.

3. Finding negative numbers in the computer's form of expression

-13 = 0b 1111 0011

4. The corresponding integer form according to the binary number

0b1111 0011 = 13

5.Java class, interface, method, etc. all use {} as delimiter
basic data types in 6.Java simple memory : four classes of eight
There are four kinds of integers, 2 kinds of floating-point type, character type, Boolean type of each one
7. Automatic type conversion of basic data Types : From small to wide range
Forced type conversions for basic data types: from large to small range
8. There are 4 ways to represent integer values :
Decimal 150 number on each of the 0-9
Binary 0b10100010 0b10100010 The number on each one can only be 0/1
Octal 054 077 The number on each one can only be 0-7.
Hex 0X12AA 0x1ef The number on each one can only be 0-9 a-f
9. Conversion between the binary
Decimal is converted into any binary, divided by the corresponding number of digits, and the remainder is inverted
Any binary number is converted to a decimal number, multiplied by the number of digits on the corresponding bit (the power of the binary number)
0x63---decimal?
Binary to octal: every three bits converted into an octal number
octal to binary: an octal number converted to a three-bit binary number
Binary and 16 binary:
Octal and 16 binary: first converted to binary
10. Representation of the number: complement
1. Given a negative number to find its representation in the computer
First find the corresponding positive representation, then use the law
2. Given a binary number, ask for the decimal integer it represents
Investigate symbol bit: positive number in binary decimal mode;
Negative numbers directly according to the law to find the corresponding positive number of the original code, you can get the value of this negative

11. Comparison operator types

Operator: +-*%/+ +--

12. Logical operator type, short-circuit and, short-circuit or meaning

&-Logic and |  -Logical OR! -Logical Non-

&&-Short circuit with | | -Short circuit or ^-logic XOR

Logical operators are used to concatenate Boolean expressions that cannot be written as 3<x<6 in Java and should be written in X>3 & X<6.

The difference between "&" and "&&":

Single &, both True and false on the left, the right side of the operation;

Double & If the left is true, the right side participates in the operation, if the left is false, then the right side does not participate in the operation.

| and "| |" The same as the difference, | | Indicates: When the left is true, the right side does not participate in the operation.

XOR (^) with or (|) The difference is:

Or when the left and right phases are the same, the result is false. Not at the same time, the result is ture.

With or around the same, the result is false. At the same time, the result is ture.

Understanding: Different Or, the pursuit is "different"!

13. Bit operator type, signed right shift >> unsigned right shift >>> meaning

Summarize:

There are four symbols for a single number operation.

There are three symbols that operate on two numbers

Summary rule:

The result of the XOR operation and the original number can be different or the other value will be obtained.

Application scenario: Swap, encrypt.

Unsigned right-shift results are always positive.

For a positive number, the symbol is shifted to the right and the unsigned right shifts to the same digits, with the same result.

For a negative number, the symbol is shifted to the right, and the unsigned right shifts the same digits, and the result is definitely not the same.

Big Data Java Foundation the next day

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.