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 の Math.pow を bitshift に置き換える必要があります。
for (int i = n - 1; i >= 0; i--) Math.pow(16, n - i - 1)
ここで、n は 16 進数の長さです。 13304fb は n= 7 を意味 します。基本的には 16 進数を 10 進数に変換しています。
次に、その Math.pow を Bitshift に置き換える必要があります。n は好きなだけ大きくなる可能性があるため、わかりません。
16^(n - i -1)
2^(4 * (n - i -1))
2^x
1 << x.
したがって: 16^(n-i-1)=1 << (4 * (n -i -1))
16^(n-i-1)
1 << (4 * (n -i -1))
(^シンボルを使用して、XOR ではなく、「のべき乗」を意味します)
^