Java Array Truncate truncate(byte[] nextPartBytes, int partSize)

Here you can find the source of truncate(byte[] nextPartBytes, int partSize)

Description

truncate

License

Apache License

Declaration

static byte[] truncate(byte[] nextPartBytes, int partSize) 

Method Source Code

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

public class Main {
    static byte[] truncate(byte[] nextPartBytes, int partSize) {
        if (partSize >= nextPartBytes.length) {
            return nextPartBytes;
        }//w w  w .  j  a  v  a2s  .com
        byte[] result = new byte[partSize];
        System.arraycopy(nextPartBytes, 0, result, 0, partSize);
        return result;
    }
}

Related

  1. truncate(byte[] array, int newLength)
  2. truncate(byte[] element, int length)
  3. truncate(int[] array, int maxLen)
  4. truncate(int[] values, int value)
  5. truncate(short[] value, int maxSize)
  6. truncateAndConvertToInt(long[] longArray)