Here you can find the source of truncate(short[] value, int maxSize)
Parameter | Description |
---|---|
value | a parameter |
size | a parameter |
public static short[] truncate(short[] value, int maxSize)
//package com.java2s; public class Main { /**/*from ww w.jav a 2 s .c om*/ * Truncate an array of shorts to a specified size * * @param value * @param size * @return the truncated array of shorts */ public static short[] truncate(short[] value, int maxSize) { int actualSize = maxSize; if (actualSize > value.length) { actualSize = value.length; } short[] returnValue = new short[actualSize]; for (int i = 0; i < actualSize; i++) { returnValue[i] = value[i]; } return returnValue; } }