長い数字があります。今、私は(擬似コードで指定)は、次のされたい、ロング・カウント・セットおよびアンセット・ビットでのJavaビット操作
int cnt1 = 0
int cnt2 = 0
for each two bits of that long
if the two bits == 11
then cnt1++
else
cnt2++
Print i and i+1 th bits are ... (example 00, 11 etc.) and cnt1 = ... and cnt2 = ...
(for example if number is three (representation "00 00 00 .... 11)"
it will give output cnt1 = 1 and cnt2 = 31)
は誰がどのようにそれを行うために私を助けることができますか?あなたがする必要がどのような
@Jeffrey、。しかし、最も左の0ビットの例 "00 00..11" – Arpssss
@haroldの問題を解決する方法を理解することはできません。例えば、i番目とi + 1番目のビットは "this"と対応するカウントです。 – Arpssss
@Arpssssはい私はそれを見ました、今、その示唆を無視してください。 – harold