We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 414ec18 commit 49ceb7bCopy full SHA for 49ceb7b
problems/190.reverse-bits.md
@@ -75,7 +75,7 @@ eg :
75
76
## 代码
77
78
-- 语言支持:JS,C++,Python
+- 语言支持:JS,C++,Python,Java
79
80
JavaScript Code:
81
@@ -132,6 +132,21 @@ class Solution:
132
return ans
133
```
134
135
+Java Code:
136
+
137
+```java
138
+public class Solution {
139
+ public int reverseBits(int n) {
140
+ int rev = 0;
141
+ for (int i = 0; i < 32 && n != 0; ++i) {
142
+ rev |= (n & 1) << (31 - i);
143
+ n >>>= 1;
144
+ }
145
+ return rev;
146
147
+}
148
+```
149
150
**复杂度分析**
151
152
- 时间复杂度:$O(logN)$
0 commit comments