Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static String[] popAtLast(String[] resource, int length) { List<String> list = new ArrayList<>(); for (int i = 0; i < length; i++) { list.add(resource[i]); } String[] result = list.toArray(resource); return result; } }