Lines Matching refs:array
60 * {@code array}.
62 * @param array an array of {@code byte} values, possibly empty
64 * @return {@code true} if {@code array[i] == target} for some value of {@code
67 public static boolean contains(byte[] array, byte target) {
68 for (byte value : array) {
78 * {@code array}.
80 * @param array an array of {@code byte} values, possibly empty
82 * @return the least index {@code i} for which {@code array[i] == target}, or
85 public static int indexOf(byte[] array, byte target) {
86 return indexOf(array, target, 0, array.length);
91 byte[] array, byte target, int start, int end) {
93 if (array[i] == target) {
102 * target} within {@code array}, or {@code -1} if there is no such occurrence.
105 * java.util.Arrays.copyOfRange(array, i, i + target.length)} contains exactly
108 * @param array the array to search for the sequence {@code target}
109 * @param target the array to search for as a sub-sequence of {@code array}
111 public static int indexOf(byte[] array, byte[] target) {
112 checkNotNull(array, "array");
119 for (int i = 0; i < array.length - target.length + 1; i++) {
121 if (array[i + j] != target[j]) {
132 * {@code array}.
134 * @param array an array of {@code byte} values, possibly empty
136 * @return the greatest index {@code i} for which {@code array[i] == target},
139 public static int lastIndexOf(byte[] array, byte target) {
140 return lastIndexOf(array, target, 0, array.length);
145 byte[] array, byte target, int start, int end) {
147 if (array[i] == target) {
155 * Returns the values from each provided array combined into a single array.
157 * byte[] {c}} returns the array {@code {a, b, c}}.
160 * @return a single array containing all the values from the source arrays, in
165 for (byte[] array : arrays) {
166 length += array.length;
170 for (byte[] array : arrays) {
171 System.arraycopy(array, 0, result, pos, array.length);
172 pos += array.length;
178 * Returns an array containing the same values as {@code array}, but
179 * guaranteed to be of a specified minimum length. If {@code array} already
181 * Otherwise, a new array of size {@code minLength + padding} is returned,
182 * containing the values of {@code array}, and zeroes in the remaining places.
184 * @param array the source array
185 * @param minLength the minimum length the returned array must guarantee
186 * @param padding an extra amount to "grow" the array by if growth is
190 * @return an array containing the values of {@code array}, with guaranteed
194 byte[] array, int minLength, int padding) {
197 return (array.length < minLength)
198 ? copyOf(array, minLength + padding)
199 : array;
210 * Copies a collection of {@code Byte} instances into a new array of
218 * @return an array containing the same values as {@code collection}, in the
230 byte[] array = new byte[len];
232 array[i] = (Byte) boxedArray[i];
234 return array;
238 * Returns a fixed-size list backed by the specified array, similar to {@link
248 * @param backingArray the array to back the list
249 * @return a list view of the array
261 final byte[] array;
265 ByteArrayAsList(byte[] array) {
266 this(array, 0, array.length);
269 ByteArrayAsList(byte[] array, int start, int end) {
270 this.array = array;
285 return array[start + index];
291 && Bytes.indexOf(array, (Byte) target, start, end) != -1;
297 int i = Bytes.indexOf(array, (Byte) target, start, end);
308 int i = Bytes.lastIndexOf(array, (Byte) target, start, end);
318 byte oldValue = array[start + index];
319 array[start + index] = element;
330 return new ByteArrayAsList(array, start + fromIndex, start + toIndex);
344 if (array[start + i] != that.array[that.start + i]) {
356 result = 31 * result + Bytes.hashCode(array[i]);
363 builder.append('[').append(array[start]);
365 builder.append(", ").append(array[i]);
374 System.arraycopy(array, start, result, 0, size);