I try to use Math.reverseBytes in Java but giving error : The method reverseBytes() is undefined for the type Math
As you know it is static type . Why cant i use it?
import java.lang.Integer;
public class Test {
public static void main(String[] args) {
int x = Math.reverseBytes();//Eclipse cannot reach this function
}
}
From Java Doc – Some Information
reverseBytes
public static int reverseBytes(int i);
Returns the value obtained by reversing the order of the bytes in the two’s complement representation of the specified int value.
Returns:
the value obtained by reversing the bytes in the specified int value.
Since:
1.5
There IS no “Math.reverseBytes()”.
Integer.reverseBytes() or Short.reverseBytes(), yes. Math – no.
PS:
You should definitely install JavaDoc in your Eclipse. Here’s how: