1

LargeIntegerに相当するものはありBigIntegerますtestBitか?

そうでない場合、どのようtestBitに実行できますLargeIntegerか?

私はまだ再現するのに必要なスキルを持っていません((this & (1<<n)) != 0)


ドキュメントから参照されている上記のコードをコピーして貼り付けるだけでメソッドを作成しようとしました:

static boolean testBit(int n){
    return ((this & (1<<n)) != 0);
}

ただし、コンパイラは次のように報告します。

error: non-static variable this cannot be referenced from a static context
    return ((this & (1<<n)) != 0);
             ^
error: bad operand types for binary operator '&'
    return ((this & (1<<n)) != 0);
                  ^
4

1 に答える 1