Java Array Fill fillArrayWith(byte[] dest, byte[] pattern)

Here you can find the source of fillArrayWith(byte[] dest, byte[] pattern)

Description

fill Array With

License

Open Source License

Declaration

static public void fillArrayWith(byte[] dest, byte[] pattern) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2009  Clark N. Hobbie//from   ww  w.j av a  2  s.  co  m
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Clark N. Hobbie - initial API and implementation
 *******************************************************************************/

public class Main {
    static public void fillArrayWith(byte[] dest, byte[] pattern) {
        int count = 0;
        while (count < dest.length) {
            for (int i = 0; i < pattern.length; i++) {
                dest[count] = pattern[i];
                count++;
            }
        }
    }
}

Related

  1. fillArray(Object[] objects, Object object)
  2. fillArray(String value, int length)
  3. fillArray(String[] array, int size, String fillString)
  4. fillArray(T[] arr, T val)
  5. fillArray2D(double[][] arr, double value)
  6. fillArrayWithByte(byte[] array, byte value)
  7. fillArrayWithHalfSorted(int[] nums)
  8. fillColor(int[][] dist)
  9. filledIntArray(int length, int cont)