Here you can find the source of subArray(byte[] in, int start, int end)
Parameter | Description |
---|---|
in | a parameter |
start | a parameter |
end | a parameter |
public static final byte[] subArray(byte[] in, int start, int end)
//package com.java2s; //License from project: Apache License public class Main { /**//from www .j av a 2 s . co m * Returns a sub-array of the input array with range * specified by the starting (inclusive) and ending (exclusive) * indices. * @param in * @param start * @param end * @return */ public static final byte[] subArray(byte[] in, int start, int end) { int N = end - start; byte[] out = new byte[N]; for (int i = 0; i < N; i++) { out[i] = in[i + start]; } return out; } /** * Returns a sub-array of the input array with range *specified by the starting (inclusive) and ending (exclusive) * indices. * @param in * @param start * @param end * @return */ public static final int[] subArray(int[] in, int start, int end) { int N = end - start; int[] out = new int[N]; for (int i = 0; i < N; i++) { out[i] = in[i + start]; } return out; } /** * Returns a sub-array of the input array with range * specified by the starting (inclusive) and ending (exclusive) * indices. * @param in * @param start * @param end * @return */ public static final long[] subArray(long[] in, int start, int end) { int N = end - start; long[] out = new long[N]; for (int i = 0; i < N; i++) { out[i] = in[i + start]; } return out; } /** * Returns a sub-array of the input array with range * specified by the starting (inclusive) and ending (exclusive) * indices. * @param in * @param start * @param end * @return */ public static final float[] subArray(float[] in, int start, int end) { int N = end - start; float[] out = new float[N]; for (int i = 0; i < N; i++) { out[i] = in[i + start]; } return out; } /** * Returns a sub-array of the input array with range * specified by the starting (inclusive) and ending (exclusive) * indices. * @param in * @param start * @param end * @return */ public static final double[] subArray(double[] in, int start, int end) { int N = end - start; double[] out = new double[N]; for (int i = 0; i < N; i++) { out[i] = in[i + start]; } return out; } }