Java programming Things 8-data expression in the computer

Source: Internet
Author: User

Java programming those things 8-computer internal data expression by Chen yuefeng from: http://blog.csdn.net/mailbomb 1.3 Data expression in the computerThe general principle of data expression in computers is to digitize and digitize all content. This is also the basic way to process data during programming. The deeper the understanding of programming, the more I agree with this principle. In fact, the computer can only do this, because the computer can only store two numbers, 0 and 1, therefore, commands, Data, images, text, and other content must be digitalized into 0 and 1 for storage, transmission, and display. 1.3.1 integer expressionIntegers can be positive or negative, but only 0 and 1 can be stored in the computer. The computer digitizes the symbols and uses the highest bit of the binary code to represent the symbol bit. It must be 0 to represent the positive, 1 indicates negative. This is the symbol digitalization provision. We have mentioned that integers are saved in binary format in the computer. However, for the convenience of computing and the simplicity of the CPU structure, the storage and operation are completed in the form of a complement. The binary format directly calculated in the previous section is called the original integer code. The original code, reverse code, and complement code of a specified positive number are all themselves. For negative numbers, take a closer look at the composition format. Take an 8-bit machine as an example, that is, a number occupies 8 bits in the computer, that is, a byte. It stores the symbol bits with the highest bits, and other bits store the values. For example, if the source code of-8 is 10001000, the first digit of the highest digit represents a negative number, And the next seven digits represent a value. A negative number indicates that the bitwise of the sign remains unchanged. If the bitwise of other digits is reversed, that is, if the bitwise of 0 is changed to 11110111 and the bitwise of-8 is changed to 0, the bitwise of-8 is. The complement of a negative number is the result obtained after adding 1 to the bitwise of the anticode. Only the bitwise value is calculated without changing the bitwise of the symbol. The complement code of-8 is 11111000. In this operation, the low position carries the carry to the high bit. Rule: the source code of the complement code is equal to the negative number. That is, the original code of the negative number after the complement is obtained. Familiar with integer expressions is helpful for understanding the data intervals and the values obtained after forced conversion. It is also the basis for bitwise operations. Note: decimal point, which is a floating point in programming language. The storage format is different from the integer. Expression of 1.3.2 charactersA single character in a computer, such as punctuation, English letters, and Chinese characters. Because these characters are of different types and cannot be expressed directly by computers, each character is numbered in computer programming. For example, a character is numbered 97, the B character number is 98 and so on. Because many characters need to be numbered, a series of character and number matching rules are specified, these corresponding tables are called character sets. Common Character sets include ASCII, gb2312, and big5. You only need to use this number to store, operate, and transmit data in the computer. The character set perfectly solves the problem of character storage and transmission. Therefore, the character can be involved in the operation within the program. In fact, it is involved in the operation of the character number. The character set rule is the basis for the implementation of many character transformation logics. Note: character display is implemented by a special character display code. 1.3.3 conclusionIn fact, everything in the computer is stored in the form of numbers. Here we only hope that through these two simple structures, we can understand the idea of digitalized data, this is one of the common ideas for programming.

 

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.