0

Java で Math.reverseBytes を使用しようとしましたが、エラーが発生しました: The method reverseBytes() is undefined for the type Math

ご存じのとおり static 型です。なんで使えないの?

import java.lang.Integer;

public class Test {
    public static void main(String[] args) {
        int x = Math.reverseBytes();//Eclipse cannot reach this function
    }
}

Java Doc から - いくつかの情報

逆バイト数

public static int reverseBytes(int i);

指定された int 値の 2 の補数表現のバイトの順序を逆にした値を返します。

戻り値: 指定された int 値のバイトを反転して得られた値。

以降: 1.5

4

2 に答える 2

8

「 Math.reverseBytes ()」はありません。

Integer.reverseBytes() または Short.reverseBytes()、はい。数学 - いいえ。

PS:

Eclipse には必ず JavaDoc をインストールする必要があります。方法は次のとおりです。

于 2012-12-04T03:06:34.930 に答える
1

このメソッドは、Math パッケージには存在しません。
あなたのコードでは、java.lang.Integer をインポートしました。

Integer.reverseBytes()

?

于 2012-12-04T03:06:33.937 に答える