乱七八糟
来源:互联网 发布:淘宝有哪些软妹 编辑:程序博客网 时间:2024/05/16 13:57
int temp = generalParas.get(GeneralParaKey.P1) | generalParas.get(GeneralParaKey.P1) <<1 | generalParas.get(GeneralParaKey.P3) <<2 |
generalParas.get(GeneralParaKey.P4) <<3 | generalParas.get(GeneralParaKey.P5) <<4 | generalParas.get(GeneralParaKey.P6)<<5|
generalParas.get(GeneralParaKey.P7) <<6;
public class Test {
public static void main(String[] args) {
int a=35461;
System.out.println(Test.byte2int(Test.int2byte(a)));
}
/**
* 将int转化成byte[]
*
* @param res 要转化的整数
* @return 对应的byte[]
*/
public static byte[] int2byte(int res) {
byte[] targets = new byte[4];
targets[0] = (byte) (res & 0xff);// 最低位
targets[1] = (byte) ((res >> 8) & 0xff);// 次低位
targets[2] = (byte) ((res >> 16) & 0xff);// 次高位
targets[3] = (byte) (res >>> 24);// 最高位,无符号右移。
return targets;
}
/**
* 将byte[]转化成int
* @param res 要转化的byte[]
* @return 对应的整数
*/
public static int byte2int(byte[] res) {
int targets = (res[0] & 0xff) | ((res[1] << 8) & 0xff00) | ((res[2] << 24) >>> 8) | (res[3] << 24);
return targets;
}
}
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- 乱七八糟
- Delphi7 动态链接库编程学习点滴
- 可移动悬浮框
- Ubuntu终端里面显示路径名称太长,怎么设置变短?
- GridView 中生成了<thead>、<tbody>标记分页时报错解决方案
- 顶点法线和面法线
- 乱七八糟
- Mahout随机森林算法源码分析(2-4)
- visual studio2010各操作说明
- memcached之java客户端:spymemcached使用
- K均值(KMeans)
- 关于进程和线程的一点小知识~
- ORA-12162: TNS:net service name is incorrectly specified
- 架构设计摘录
- 写OCX注意