Here you can find the source of array_intAddLimit(int[] in, int value, int limit)
public static int[] array_intAddLimit(int[] in, int value, int limit)
//package com.java2s; //License from project: Open Source License public class Main { public static int[] array_intAddLimit(int[] in, int value, int limit) { int[] ret = new int[Math.min(in.length + 1, limit)]; System.arraycopy(in, Math.max(0, in.length - limit), ret, 0, in.length);//from ww w . j a va2 s . c o m ret[Math.min(in.length, limit - 1)] = value; return ret; } }