sdf
This commit is contained in:
@@ -10,6 +10,20 @@ import java.util.Arrays;
|
||||
*/
|
||||
public abstract class LangUtils {
|
||||
|
||||
|
||||
public static byte[] removeLastZero(byte[] bytes) {
|
||||
if (bytes == null) {
|
||||
return bytes;
|
||||
}
|
||||
int len = bytes.length;
|
||||
for (int i = len - 1; i >= 0; i--) {
|
||||
if (bytes[i] != 0) {
|
||||
return Arrays.copyOfRange(bytes, 0, i + 1);
|
||||
}
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static byte[] merge(byte[]... bytes) {
|
||||
int newLen = Arrays.stream(bytes).mapToInt(it -> it.length).sum();
|
||||
byte[] res = new byte[newLen];
|
||||
|
||||
Reference in New Issue
Block a user