title: Truncate an array without copying it?
body: <p>In Java, is there a way to truncate an array without having to make a copy of it? The common idiom is <code>Arrays.copyOf(foo, n)</code> (where the new array is n elements long). I don't think there is an alternative, but I'm curious as to whether there is a better approach.</p>