java byte追加_byte数组追加 java

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-29 20:53   33   0

package com.yyy.test; import java.util.zip.CRC32; public class TestJava { public static void main(String arg[]) { System.out.println("time:"+System.currentTimeMillis() ); String str = "100000"; byte a = (byte) 0xff; // 扩充的长度 int len = str.length(); int maxLen = (len - 1) / 4 * 4 + 4; // 增加的个数 int add = maxLen - len; byte tempAdd[]=new byte[add]; for (int i = 0; i < tempAdd.length; i++) { tempAdd[i]=a; } byte[] xxx=byteMerger(str.getBytes(), tempAdd); CRC32 c = new CRC32(); c.update(xxx); System.out.println(Integer.toHexString((int) c.getValue())); System.out.println("time:"+System.currentTimeMillis() ); byte[] temp = new byte[8]; temp[0]=0x31; temp[1]=0x30; temp[2]=0x30; temp[3]=0x30; temp[4]=0x30; temp[5]=0x30; temp[6]=(byte) 0xff; temp[7]=(byte) 0xff; System.out.println(new String(temp)); CRC32 c1 = new CRC32(); c1.update(temp); Sys

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP