190. Reverse Bits
2016-06-16 10:34
288 查看
题目:https://leetcode.com/problems/reverse-bits/
代码:
代码:
public class Solution { // you need treat n as an unsigned value public int reverseBits(int n) { int bit; int res=0; for(int i=0;i<32;i++,n=n>>1) { bit = (1&n); res = res|(bit<<(31-i)); } return res; } }
相关文章推荐
- ArcGIS教程:创建带状地图索引要素
- 用一个函数返回参数二进制中1的个数
- 不使用递归实现归并排序
- 浪潮之巅阅读笔记二
- Android(我还是个菜鸟)——UI-开源框架ImageLoader的完美例子
- Reids Cluster 部署
- iOS键盘高度的获取
- 关于九度OJ 1202问题的再讨论
- 观察者模式理解及demo
- golang map to struct
- tail和head命令
- Qt 常用类(5)—— QSize
- INS-35172 Target database memory(945MB) excessds the systems available shared memory({0}MB)
- DateTimePicker
- 网络号与子网号区别
- iOS SVN CornerStone上传静态库(.a文件)
- 华为机试---删数
- 分布式框架Dubbo
- Java ConcurrentModificationException异常原因和解决方法
- [js]事件篇