1
zhang
1 天以前 e9cc2b361b5788c5e7aac0af3fe53031a76a6787
zy-acs-common/src/main/java/com/zy/acs/common/utils/Utils.java
@@ -2,10 +2,7 @@
import com.zy.acs.framework.common.Cools;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Function;
@@ -76,6 +73,7 @@
    /**
     * 截取数组
     *
     * @param bytes 原数组
     * @param pos   定位(截取后包含定位点数据)
     * @param len   长度
@@ -258,14 +256,28 @@
        if (Cools.isEmpty(lastSeqNum)) {
            return zeroFill("1", 4);
        } else {
            if (isNumericZidai(lastSeqNum)) {
            int i = Integer.parseInt(lastSeqNum);
            if (i >= 9999) {
                return zeroFill("1", 4);
            } else {
                return zeroFill(String.valueOf(i+1), 4);
            }
            } else {
                return zeroFill(new Random().nextInt(1000000) + "", 6);
        }
    }
    }
    public static boolean isNumericZidai(String str) {
        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
    // pos start in 0
    public static boolean getBit(byte b, int position) {