mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
package org.dromara.hutool.core.util;
|
||||
|
||||
import org.dromara.hutool.core.io.buffer.FastByteBuffer;
|
||||
import org.dromara.hutool.core.math.NumberUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -608,4 +609,24 @@ public class ByteUtil {
|
||||
}
|
||||
return new BigInteger(1, mag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接多个byte[]
|
||||
*
|
||||
* @param byteArrays 多个byte[]
|
||||
* @return 连接后的byte[]
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public static byte[] concat(final byte[]... byteArrays){
|
||||
int totalLength = 0;
|
||||
for (final byte[] byteArray : byteArrays) {
|
||||
totalLength += byteArray.length;
|
||||
}
|
||||
|
||||
final FastByteBuffer buffer = new FastByteBuffer(totalLength);
|
||||
for (final byte[] byteArray : byteArrays) {
|
||||
buffer.append(byteArray);
|
||||
}
|
||||
return buffer.toArrayZeroCopyIfPossible();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user