protected T[] resize(int newSize) { T[] items = this.items; T[] newItems = (T[]) new Object[newSize]; System.arraycopy(items, 0, newItems, 0, MathUtils.min(size, newItems.length)); this.items = newItems; return newItems; }
/** * A simple constructor * * @param data data * @param nbins nbins */ public Histogram(double[] data, int nbins) { double min = MathUtils.min(data); double max = MathUtils.max(data); setHistogram(data, nbins, min, max); }
public Histogram(double[] data) { double min = MathUtils.min(data); double max = MathUtils.max(data); setHistogram(data, 15, min, max); }
public static IntHashMap.Entry[] copyOf(IntHashMap.Entry[] obj, int newSize) { IntHashMap.Entry tempArr[] = new IntHashMap.Entry[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
public static LTexture[] copyOf(LTexture[] obj, int newSize) { LTexture tempArr[] = new LTexture[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
public static PSortableObject[] copyOf(PSortableObject[] obj, int newSize) { PSortableObject tempArr[] = new PSortableObject[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
public static PBody[] copyOf(PBody[] obj, int newSize) { PBody tempArr[] = new PBody[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
public static PConvexPolygonShape[] copyOf(PConvexPolygonShape[] obj, int newSize) { PConvexPolygonShape tempArr[] = new PConvexPolygonShape[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
/** * copy指定长度的数组数据 * * @param obj * @param newSize * @return */ public static boolean[] copyOf(boolean[] obj, int newSize) { boolean tempArr[] = new boolean[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
/** * copy指定长度的数组数据 * * @param obj * @param newSize * @return */ public static long[] copyOf(long[] obj, int newSize) { long tempArr[] = new long[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
/** * copy指定长度的数组数据 * * @param obj * @param newSize * @return */ public static char[] copyOf(char[] obj, int newSize) { char tempArr[] = new char[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }
/** * copy指定长度的数组数据 * * @param obj * @param newSize * @return */ public static float[] copyOf(float[] obj, int newSize) { float tempArr[] = new float[newSize]; System.arraycopy(obj, 0, tempArr, 0, MathUtils.min(obj.length, newSize)); return tempArr; }