我无法对Java中的Math.reverseBytes做出反应

我无法对Java中的Math.reverseBytes做出反应,java,Java,我尝试在Java中使用Math.reverseBytes,但给出了一个错误:没有为Math类型定义reverseBytes()方法 正如您所知,它是静态类型。为什么我不能用它 import java.lang.Integer; public class Test { public static void main(String[] args) { int x = Math.reverseBytes();//Eclipse cannot reach this functi

我尝试在Java中使用Math.reverseBytes,但给出了一个错误:没有为Math类型定义reverseBytes()方法

正如您所知,它是静态类型。为什么我不能用它

import java.lang.Integer;

public class Test {
    public static void main(String[] args) {
        int x = Math.reverseBytes();//Eclipse cannot reach this function
    }
}
来自Java文档-一些信息

反向字节

public static int reverseBytes(int i);
返回通过颠倒指定int值的两个补码表示形式中字节的顺序而获得的值

返回: 通过在指定的int值中反转字节而获得的值

自:
1.5

此方法在Math软件包中不存在
在您的代码中导入了java.lang.Integer,这是什么意思

Integer.reverseBytes()

没有“Math.reverseBytes()”

Integer.reverseBytes()或Short.reverseBytes(),是。数学-不

附言:

您应该在Eclipse中安装JavaDoc。以下是方法:


我从来没有听说过这种方法,现在我来查一下。你在数学课上引用的Javadoc并不存在。这不是一个真正的问题。您正在查找
Integer.reverseBytes(inti)
,因此请使用
intx=Integer.reverseByte(yourIntValue)