admin 管理员组文章数量: 887021
2024年1月11日发(作者:oracle数据库安装后怎么打开)
for (int i = 1; i < blockCount; i++) { int idx = (i - 1) * blockSize; range = Range(data, idx, idx + blockSize); n("Chunk " + i + ": " ng(range));}// Last chunkint end = -1;if ( % blockSize == 0) { end = ;} else { end = % blockSize + blockSize * (blockCount - 1);}
range = Range(data, (blockCount - 1) * blockSize, end);n("Chunk " + blockCount + ": " ng(range));
以上代码不能分割byte数组,分割byte数组如下byte[] data = { 2, 3, 5, 7, 8, 9, 11, 12, 13 };int blockSize = 3;int blockCount = ( + blockSize - 1) / blockSize;byte[] range = null;for (int i = 1; i < blockCount; i++) { int idx = (i - 1) * blockSize; range = Range(data, idx, idx + blockSize); n("Chunk " + i + ": " ng(range));}// Last chunkint end = -1;if ( % blockSize == 0) { end = ;} else { end = % blockSize + blockSize * (blockCount - 1);}
range = Range(data, (blockCount - 1) * blockSize, end);n("Chunk " + blockCount + ": " ng(range));
版权声明:本文标题:java中将一个数组按照每份固定大小拆分 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1704964449h468285.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论