<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    咖啡伴侶

    呆在上海
    posts - 163, comments - 156, trackbacks - 0, articles - 2

    JAVA 移位運算符 << >> >>>

    Posted on 2008-03-28 10:08 oathleo 閱讀(599) 評論(0)  編輯  收藏 所屬分類: Java

    /*
    * show the arthimetic character of '<<' '>>' '>>>'
    */

    public class TestArithmetic {
    ?? public TestArithmetic() {
    ?? }
    ??
    ?? public?? static void?? main(String [] args){
    ???? int minus = -10;
    ???? System.out.println(" Binary of -10 is " + Integer.toBinaryString(minus));
    ???? System.out.println(" Arthimetic minus by -10 << 2 = " + (minus<<2) + " Binary is " + Integer.toBinaryString(minus<<2));
    ???? System.out.println(" Arthimetic minus by -10 >> 2 = " + (minus>>2) + " Binary is " + Integer.toBinaryString(minus>>2));
    ???? System.out.println(" Arthimetic minus by -10 >>>2 =?? " + (minus >>> 2) + " Binary is " + Integer.toBinaryString(minus>>>2)
    ??????????????????????? + ",length is " + Integer.toBinaryString(minus>>>2).length());
    ????
    ???? int plus = 10;
    ???? System.out.println(" Binary of 10 is " + Integer.toBinaryString(plus));
    ???? System.out.println(" Arthimetic minus by 10 << 2 = " + (plus<<2)+ "Binary is " + Integer.toBinaryString(plus<<2));
    ???? System.out.println(" Arthimetic minus by 10 >> 2 = " + (plus>>2)+ "Binary is "+ Integer.toBinaryString(plus>>2));
    ???? System.out.println(" Arthimetic minus by 10 >>>2 =?? " + (plus >>> 2)+ "Binary is "+ Integer.toBinaryString(plus >>> 2));
    ?? }

    補充知識:數值的補碼表示也分兩種情況:
    (1)正數的補碼:與原碼相同。
    例如,+9的補碼是00001001。
    (2)負數的補碼:符號位為1,其余位為該數絕對值的原碼按位取反;然后整個數加1。
    例如,-7的補碼:因為是負數,則符號位為“1”,整個為10000111;其余7位為-7的絕對值+7的原碼0000111按位取反為1111000;再加1,所以-7的補碼是11111001。


    已知一個數的補碼,求原碼的操作分兩種情況:
    (1)如果補碼的符號位為“0”,表示是一個正數,所以補碼就是該數的原碼。
    (2)如果補碼的符號位為“1”,表示是一個負數,求原碼的操作可以是:符號位為1,其余各位取反,然后再整個數加1。
    例如,已知一個補碼為11111001,則原碼是10000111(-7):因為符號位為“1”,表示是一個負數,所以該位不變,仍為“1”;其余7位1111001取反后為0000110;再加1,所以是10000111。

    主站蜘蛛池模板: 亚洲国产精品13p| 国产高清免费的视频| 77777亚洲午夜久久多人| 黄色大片免费网站| 亚洲精品无码你懂的网站| 国产亚洲Av综合人人澡精品| 在线看片人成视频免费无遮挡| 亚洲已满18点击进入在线观看| 无码日韩人妻av一区免费| 亚洲精品无码av片| 国产一级大片免费看| 午夜亚洲国产精品福利| 亚洲精品麻豆av| 成人免费ā片在线观看| 久久99国产亚洲高清观看首页| 中文字幕免费不卡二区 | 四虎亚洲国产成人久久精品 | 亚洲AV第一成肉网| 亚洲 无码 在线 专区| sihu国产精品永久免费| 久久亚洲精品成人综合| 蜜臀AV免费一区二区三区| 亚洲一区二区三区国产精品无码| 亚洲免费网站观看视频| 在线观看亚洲专区| 亚洲乱色熟女一区二区三区丝袜| 99精品视频在线视频免费观看| 亚洲a级在线观看| 成人永久免费高清| 国产精品免费大片| 亚洲男人天堂2018av| 久久精品国产亚洲一区二区三区| 黄网站色视频免费在线观看的a站最新| 精品亚洲麻豆1区2区3区| 日本免费人成黄页网观看视频| japanese色国产在线看免费| 亚洲天堂男人天堂| 免费精品国产自产拍观看| 免费h视频在线观看| 精品国产亚洲AV麻豆| 亚洲精品私拍国产福利在线|