Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はこれまでJavaでビットを操作したことがないので、質問は次のとおりです。
byte a=254;
msbの位置から始めて、このバイトからビットを取得するにはどうすればよいですか?
If position == 0 it returns 1 If position == 7 it returns 0
前もって感謝します
int getBitFromMSB(byte x,int position){ return (x >>> (7 - position)) & 1; }