zuoxiao
2024-03-06 1cbb505922e010cace51020773a2dc1529713322
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.dayu.rechargeqh.tools;
 
/**
 * Copyright (C), 2022,
 * Author: zuo
 * Date: 2022/3/9 20:22
 * Description:数组工具类
 */
public class ArraysUtil {
 
    /**
     * @param base  主数组
     * @param son   子数组(需要融合进主数组的数组)
     * @param index 从主数组什么位置开始融合(位置数从0开始)
     * @return
     */
    public static byte[] copyof(byte[] base, byte[] son, int index) {
        try {
            if (index < base.length)
                for (int i = 0; i < son.length; i++) {
                    base[index + i] = son[i];
                }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return base;
    }
 
    /**
     * @param base  主数组
     * @param son   数据
     * @param index 从主数组什么位置开始融合(位置数从0开始)
     * @return
     */
    public static byte[] copyof(byte[] base, byte son, int index) {
        base[index] = son;
        return base;
    }
 
}