Trims an array to be exactly the target a size. @param a the array to trim @param size the desired size of the array. This value must be lesser than or equal to the size of the input array. @return a trimmed array instance
(int[] a, int size)
| 480 | * @return a trimmed array instance |
| 481 | */ |
| 482 | public static final int[] trim(int[] a, int size) { |
| 483 | //assert (size <= a.length); |
| 484 | if ( a.length == size ) { |
| 485 | return a; |
| 486 | } |
| 487 | int[] b = new int[size]; |
| 488 | System.arraycopy(a, 0, b, 0, size); |
| 489 | return b; |
| 490 | } |
| 491 | |
| 492 | /** |
| 493 | * Trims an array to be exactly the target a size. |
no outgoing calls
no test coverage detected