51CTO Big Data Learning 001

Source: Internet
Author: User

  1. Representation of negative numbers

    Negative numbers are represented by positive negation +1. The principle is that the positive and negative additions are 0; In the computer world, 0 is considered a positive number, not a non-positive or negative in the mathematical world.


    Binary representation of negative numbers:

    5:00000101

    -5:11111011 (positive members, +1)

    5+ (-5) = 100000000 1 overflow result is 0

  2. The process and principle of converting a number of byte type to 16 binary number

    The byte type takes up 8 bits, converts it to 16 decimal, converts the lower four bits to the 0x0f phase, and converts the high four bits into 0000

    The high four-bit shifts the right 4, and then the 0x0f phase, as with 0x0f, so whether a signed right shift is no longer meaningful, because after the & operation, whether or not there is a symbol, the high point becomes 0. The procedure is as follows:


    public static String convert (Byte b) {

    int low = B & 0x0F;

    int high = (b >> 4) & 0x0F;

    Char[] arr = {' 0 ', ' 1 ', ' 2 ', ' 3 ', ' 4 ', ' 5 ', ' 6 ', ' 7 ', ' 8 ', ' 9 ', ' A ', ' B ', ' C ', ' D ', ' E ', ' F '};

    Return "" + Arr[high] + Arr[low];

    }


This article is from the "full-stack daniel ing" blog, please be sure to keep this source http://skdevps.blog.51cto.com/6849425/1771023

51CTO Big Data Learning 001

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.