Remove manual array coping by using Arrays.copyOf(values, values.length)