int a = (int)(char)(byte)-1;

来源:互联网 发布:西部数码域名备案流程 编辑:程序博客网 时间:2024/06/05 14:37
public class T {    public static void main(String args[]) {        new T().toInt(-1);        new T().toByte((byte) -1);        new T().toChar((char) (byte) -1);        new T().toInt((int)(char) (byte) -1);    }    void toByte(byte b) {        for (int i = 7; i >= 0; i--) {            System.out.print((b>>i) & 0x01);        }        System.out.println();    }    void toInt(int b) {        for (int i = 31; i >= 0; i--) {            System.out.print((b>>i) & 0x01);        }        System.out.println();    }    void toChar(char b) {        for (int i = 15; i >= 0; i--) {            System.out.print((b>>i) & 0x01);        }        System.out.println();    }}1111111111111111111111111111111111111111111111111111111100000000000000001111111111111111

0 0
原创粉丝点击