Here you can find the source of removeInt(int[] cur, int val)
public static int[] removeInt(int[] cur, int val)
//package com.java2s; public class Main { public static int[] removeInt(int[] cur, int val) { if (cur == null) { return null; }/*from w w w . ja v a2 s .c o m*/ final int N = cur.length; for (int i = 0; i < N; i++) { if (cur[i] == val) { int[] ret = new int[N - 1]; if (i > 0) { System.arraycopy(cur, 0, ret, 0, i); } if (i < N - 1) { System.arraycopy(cur, i + 1, ret, i, N - i - 1); } return ret; } } return cur; } }