4 バイトを float に変換していますNaN
が、結果として取得していますが、値が必要です0.0
。私は何を間違っていますか?
これは私のコードです:
public class abc
{
public static void main(String[] args)
{
int[] arry = { 255, 255, 255, 255 };
int num = ((arry[0] << 24) & 0xFF000000) | ((arry[1] << 16) & 0xFF0000)
| ((arry[2] << 8) & 0xFF00) | (arry[3] & 0xFF);
float f = Float.intBitsToFloat(num);
f= (float) ((f < 0 ? Math.ceil(f * 10) : Math.floor(f * 10)) / 10);
System.out.println(f);
}
}