惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
SegmentFault 最新的问题
博客园 - 聂微东
罗磊的独立博客
W
WeLiveSecurity
博客园_首页
Scott Helme
Scott Helme
V
Visual Studio Blog
T
The Exploit Database - CXSecurity.com
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
Latest news
Latest news
L
Lohrmann on Cybersecurity
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
About on SuperTechFans
F
Full Disclosure
Y
Y Combinator Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 司徒正美
博客园 - Franky
C
CXSECURITY Database RSS Feed - CXSecurity.com
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
阮一峰的网络日志
阮一峰的网络日志
S
Schneier on Security
雷峰网
雷峰网
博客园 - 【当耐特】
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Engineering at Meta
Engineering at Meta
aimingoo的专栏
aimingoo的专栏
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
T
Tor Project blog
V
V2EX
爱范儿
爱范儿
C
Check Point Blog
T
Threatpost
Project Zero
Project Zero
量子位
V
Vulnerabilities – Threatpost
Know Your Adversary
Know Your Adversary
I
Intezer
G
GRAHAM CLULEY
P
Privacy & Cybersecurity Law Blog
GbyAI
GbyAI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

博客园 - 梅子黄时雨

离职反思 人际交往能力:远比你想象的重要 关于晋升 生产力提升计划 向企业一样的思考 在CentOS上搭建WordPress的博客系统 Some Useful LINQ Extension Methods MVC模式 IIS7.5配置 An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode. 显式接口成员实现 C#实现的堆栈 ASP.NET 验证控件 Gridview中合并单元格,某字段的内容相同时如何只显示一个,屏蔽相同列或行的内容(转) C#winform 配置webconfig 动态SQL EXEC DELL 1520 笔记本拆机 关于表变量 华为致新员工书
C# 整数和byte数组互换
梅子黄时雨 · 2012-03-06 · via 博客园 - 梅子黄时雨
   1:          public static byte[] int2Byte(int intValue)
   2:          {
   3:              byte[] b = new byte[4];
   4:              for (int i = 0; i < 4; i++)
   5:              {
   6:                  b[i] = (byte)(intValue >> 8 * (i) & 0xFF);
   7:              }
   8:              return b;
   9:          }
  10:   
  11:          // 将iSource转为长度为iArrayLen的byte数组,字节数组的低位是整型的低字节位
  12:          public static byte[] int2Byte(int iSource, int len)
  13:          {
  14:              byte[] b = new byte[len];
  15:              for (int i = 0; (i < 4) && (i < len); i++)
  16:              {
  17:                  b[i] = (byte)(iSource >> 8 * i & 0xFF);
  18:              }
  19:              return b;
  20:          }
  21:   
  22:          // 将byte数组bRefArr转为一个整数,字节数组的低位是整型的低字节位
  23:          public static int byte2Int(byte[] b)
  24:          {
  25:              int iOutcome = 0;
  26:              byte bLoop;
  27:              for (int i = 0; i < 4; i++)
  28:              {
  29:                  bLoop = b[i];
  30:                  iOutcome += (bLoop & 0xFF) << (8 * i);
  31:              }
  32:              return iOutcome;
  33:          }