Java Zero Format zero(byte[]... arrays)

Here you can find the source of zero(byte[]... arrays)

Description

zero

License

Open Source License

Declaration

public static void zero(byte[]... arrays) 

Method Source Code

//package com.java2s;
/*-//  w w  w .  j  a  v a  2s  .c o  m
 * Copyright (C) 2006-2007 Erik Larsson
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    public static void zero(byte[]... arrays) {
        for (byte[] ba : arrays)
            set(ba, 0, ba.length, (byte) 0);
    }

    public static void zero(byte[] ba, int offset, int length) {
        set(ba, offset, length, (byte) 0);
    }

    public static void zero(short[]... arrays) {
        for (short[] array : arrays)
            set(array, 0, array.length, (short) 0);
    }

    public static void zero(short[] ba, int offset, int length) {
        set(ba, offset, length, (short) 0);
    }

    public static void zero(int[]... arrays) {
        for (int[] array : arrays)
            set(array, 0, array.length, (int) 0);
    }

    public static void zero(int[] ba, int offset, int length) {
        set(ba, offset, length, (int) 0);
    }

    public static void zero(long[]... arrays) {
        for (long[] array : arrays)
            set(array, 0, array.length, (long) 0);
    }

    public static void zero(long[] ba, int offset, int length) {
        set(ba, offset, length, (long) 0);
    }

    public static void set(boolean[] array, boolean value) {
        set(array, 0, array.length, value);
    }

    public static void set(byte[] array, byte value) {
        set(array, 0, array.length, value);
    }

    public static void set(short[] array, short value) {
        set(array, 0, array.length, value);
    }

    public static void set(char[] array, char value) {
        set(array, 0, array.length, value);
    }

    public static void set(int[] array, int value) {
        set(array, 0, array.length, value);
    }

    public static void set(long[] array, long value) {
        set(array, 0, array.length, value);
    }

    public static <T> void set(T[] array, T value) {
        set(array, 0, array.length, value);
    }

    public static void set(boolean[] ba, int offset, int length, boolean value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }

    public static void set(byte[] ba, int offset, int length, byte value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }

    public static void set(short[] ba, int offset, int length, short value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }

    public static void set(char[] ba, int offset, int length, char value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }

    public static void set(int[] ba, int offset, int length, int value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }

    public static void set(long[] ba, int offset, int length, long value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }

    public static <T> void set(T[] ba, int offset, int length, T value) {
        for (int i = offset; i < length; ++i)
            ba[i] = value;
    }
}

Related

  1. zero(byte[] a, int aoffset, int len)
  2. zero(byte[] bytes, int off, int len)
  3. zero(double[] zero)
  4. zero(int bits)
  5. zero(int x)
  6. zero_pad(byte[] original, int block_size)