Java Array Trim trimBytes(byte[] source, int fromIndex, int toIndex)

Here you can find the source of trimBytes(byte[] source, int fromIndex, int toIndex)

Description

trim Bytes

License

Apache License

Declaration

public static byte[] trimBytes(byte[] source, int fromIndex, int toIndex) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Arrays;

public class Main {
    public static byte[] trimBytes(byte[] source, int fromIndex, int toIndex) {
        int from = source.length - toIndex;
        int to = source.length - fromIndex;
        return Arrays.copyOfRange(source, from, to);
    }//from  w w  w. j a v  a  2  s. c  o m
}

Related

  1. trim(String[] data)
  2. trim(String[] s)
  3. trim(String[] strings)
  4. trimArray(char[] buffer, int read)
  5. trimArray(final byte[] seq, final int trimFromFront, final int trimFromBack)
  6. trimLeadingZeros(byte[] original)
  7. trimLeft(byte[] src, int trimSize)
  8. trimRecords(String[] records)
  9. trimStringArray(final String[] input)