Ejemplo n.º 1
0
 /**
  * Fills a portion of the given array with the given value.
  *
  * <p>If possible (i.e., <code>from</code> is 0) this method uses a backward loop. In this case,
  * it is significantly faster than the corresponding method in {@link java.util.Arrays}.
  *
  * @param array an array.
  * @param from the starting index of the portion to fill.
  * @param to the end index of the portion to fill.
  * @param value the new value for all elements of the specified portion of the array.
  */
 public static void fill(final long[] array, final int from, int to, final long value) {
   ensureFromTo(array, from, to);
   if (from == 0) while (to-- != 0) array[to] = value;
   else for (int i = from; i < to; i++) array[i] = value;
 }