聪明文档网

聪明文档网

最新最全的文档下载
当前位置: 首页> short,int,long与byte数组之间的转换

short,int,long与byte数组之间的转换

时间:2023-11-12 10:38:03    下载该word文档

1.packagecom.test;
2.importjava.nio.ByteBuffer;
3.publicclassByteUtil{
4./**

5.*@paramargs

6.*/

7.publicstaticvoidmain(String[]args{
8.test2(;
9.}
10.publicstaticvoidtest2(
11.{
12.shorts=-20;
13.byte[]b=newbyte[2];


14.putReverseBytesShort(b,s,0;
15.ByteBufferbuf=ByteBuffer.allocate(2;
16.buf.put(b;
17.buf.flip(;
18.System.out.println(getReverseBytesShort(b,0;
19.System.out.println(Short.reverseBytes(buf.getShort(;
20.System.out.println("***************************";
21.inti=-40;
22.b=newbyte[4];
23.putReverseBytesInt(b,i,0;
24.buf=ByteBuffer.allocate(4;
25.buf.put(b;
26.buf.flip(;

免费下载 Word文档免费下载: short,int,long与byte数组之间的转换

  • 29.8

    ¥45 每天只需1.0元
    1个月 推荐
  • 9.9

    ¥15
    1天
  • 59.8

    ¥90
    3个月

选择支付方式

  • 微信付款
郑重提醒:支付后,系统自动为您完成注册

请使用微信扫码支付(元)

订单号:
支付后,系统自动为您完成注册
遇到问题请联系 在线客服

常用手机号:
用于找回密码
图片验证码:
看不清?点击更换
短信验证码:
新密码:
 
绑定后可用手机号登录
请不要关闭本页面,支付完成后请点击【支付完成】按钮
遇到问题请联系 在线客服