Web page design - Appendix E Number Systems (on CD) 1365 by

Appendix E Number Systems (on CD) 1365 by adding the two s complement of valueto a as follows: x = a + (~value + 1); Suppose a is 27 and value is 13 as before. If the two s complement of value is actually the negative of value, then adding the two s complement of value to a should produce the result 14. Let us try this: a (i.e., 27) 00000000 00000000 00000000 00011011 +(~value + 1) +11111111 11111111 11111111 11110011 00000000 00000000 00000000 00001110 which is indeed equal to 14. SUMMARY When we write an integer such as 19 or 227 or -63 in a Java program, the number is automatically assumed to be in the decimal (base 10) number system. The digits in the decimal number system are 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. The lowest digit is 0 and the highest digit is 9 one less than the base of 10. Internally, computers use the binary (base 2) number system. The binary number system has only two digits, namely 0 and 1. Its lowest digit is 0 and its highest digit is 1 one less than the base of 2. The octal number system (base 8) and the hexadecimal number system (base 16) are popular primarily because they make it convenient to abbreviate binary numbers. The digits of the octal number system range from 0 to 7. The hexadecimal number system poses a problem because it requires sixteen digits a lowest digit of 0 and a highest digit with a value equivalent to decimal 15 (one less than the base of 16). By convention, we use the letters A through F to represent the hexadecimal digits corresponding to decimal values 10 through 15. Each number system uses positional notation each position in which a digit is written has a different positional value. A particularly important relationship that both the octal number system and the hexadecimal number system have to the binary system is that the bases of octal and hexadecimal (8 and 16 respectively) are powers of the base of the binary number system (base 2). To convert an octal number to a binary number, simply replace each octal digit with its three-digit binary equivalent. To convert a hexadecimal number to a binary number, simply replace each hexadecimal digit with its four-digit binary equivalent. Because we are accustomed to working in decimal, it is convenient to convert a binary, octal or hexadecimal number to decimal to get a sense of the number s real worth. To convert a number to decimal from another base, multiply the decimal equivalent of each digit by its positional value, and sum these products. Computers represent negative numbers using two s complement notation. To form the negative of a value in binary, first form its one s complement by applying Java s bit- wise complement operator (~). This reverses the bits of the value. To form the two s complement of a value, simply add one to the value s one s complement.
Check Tomcat Web Hosting services for best quality webspace to host your web application.

Leave a Reply