Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;

public class Main {
    public static byte[] subByteArray(byte[] src, int startPos, int num) {
        int endPos = 0;

        if (startPos + num > src.length) {
            endPos = src.length;
        } else {
            endPos = startPos + num;
        }

        return Arrays.copyOfRange(src, startPos, endPos);
    }
}