我有我认为将int转换为浮点值的功能,该浮点值拆分为值的符号指数和分数部分。使用IEEE 754来表示浮点值。 unsigned test(unsigned x) {
// split the given bits of sign exponent and fraction, combine to return
unsigned int sign = (x & 0x8000
我想了解这个代码,它反转O(n)时间的位。我了解时间复杂性,但我无法理解此代码背后的逻辑。 public static long reverse(long a) {
long result = 0;
int i = 31;
while(a > 0){
result += (a % 2) * Math.pow(2, i);
i--;