Java 是否有办法在其';二进制形式?
假设我在java中有一个浮点数。如何以二进制形式打印?java库中是否有简单的方法可供使用?我说的是IEEE 754浮点。还是我必须从头开始写 我还想把它打印出来Java 是否有办法在其';二进制形式?,java,format,Java,Format,假设我在java中有一个浮点数。如何以二进制形式打印?java库中是否有简单的方法可供使用?我说的是IEEE 754浮点。还是我必须从头开始写 我还想把它打印出来 Integer.toBinaryString(Float.floatToIntBits(FloatNumber)); 示例: class FloatToBinary { public static void main( String ... args ) { int BitRep = Float.
Integer.toBinaryString(Float.floatToIntBits(FloatNumber));
示例:
class FloatToBinary {
public static void main( String ... args ) {
int BitRep = Float.floatToIntBits(12345.12346f); //Bit Representation of the Float
System.out.println(BitRep); //1178657918
String BinString = Integer.toBinaryString(BitRep); //Binary representation in String
System.out.println(BinString); //1000110010000001110010001111110
}
}
编辑
看起来已经回答了一个相同的问题:
示例:
class FloatToBinary {
public static void main( String ... args ) {
int BitRep = Float.floatToIntBits(12345.12346f); //Bit Representation of the Float
System.out.println(BitRep); //1178657918
String BinString = Integer.toBinaryString(BitRep); //Binary representation in String
System.out.println(BinString); //1000110010000001110010001111110
}
}
编辑
看起来已经回答了一个相同的问题:
示例:
class FloatToBinary {
public static void main( String ... args ) {
int BitRep = Float.floatToIntBits(12345.12346f); //Bit Representation of the Float
System.out.println(BitRep); //1178657918
String BinString = Integer.toBinaryString(BitRep); //Binary representation in String
System.out.println(BinString); //1000110010000001110010001111110
}
}
编辑
看起来已经回答了一个相同的问题:
示例:
class FloatToBinary {
public static void main( String ... args ) {
int BitRep = Float.floatToIntBits(12345.12346f); //Bit Representation of the Float
System.out.println(BitRep); //1178657918
String BinString = Integer.toBinaryString(BitRep); //Binary representation in String
System.out.println(BinString); //1000110010000001110010001111110
}
}
编辑
看起来已经回答了一个相同的问题:
我认为会奏效(向下滚动以获取更多提示)我昨天回答了一些与此非常类似的问题-请参见您可以执行的
Integer.tobinarysting(Float.floatToIntBits(f))
您的日期类型是什么?整数、浮点、双精度?查看双精度到iee754偏置127二进制。我认为会起作用(向下滚动以获取更多提示)我昨天回答了一些与此非常类似的问题-请参阅您可以执行的Integer.toBinaryString(Float.floatToIntBits(f))
您的日期类型是什么?整数、浮点、双精度?查看双精度到iee754偏置127二进制。我认为会起作用(向下滚动以获取更多提示)我昨天回答了一些与此非常类似的问题-请参阅您可以执行的Integer.toBinaryString(Float.floatToIntBits(f))
您的日期类型是什么?整数、浮点、双精度?查看双精度到iee754偏置127二进制。我认为会起作用(向下滚动以获取更多提示)我昨天回答了一些与此非常类似的问题-请参阅您可以执行的Integer.toBinaryString(Float.floatToIntBits(f))
您的日期类型是什么?整数,浮点,双精度?看看双精度到iee754二进制。如果你想要它被签名呢?如果你想要它被签名呢?如果你想要它被签名呢?如果你想要它被签名呢?