Java Zero Format zerosInt(int len)

Here you can find the source of zerosInt(int len)

Description

zeros Int

License

Open Source License

Declaration

public static int[] zerosInt(int len) 

Method Source Code

//package com.java2s;
/**//from  w w w  .  ja  v a  2 s .  co m
 * Copyright 2004-2006 DFKI GmbH.
 * All Rights Reserved.  Use is subject to license terms.
 *
 * This file is part of MARY TTS.
 *
 * MARY TTS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

public class Main {
    public static int[] zerosInt(int len) {
        return filledArray(0, len);
    }

    public static double[] filledArray(double val, int len) {
        double[] x = null;

        if (len > 0) {
            x = new double[len];
            for (int i = 0; i < len; i++)
                x[i] = val;
        }

        return x;
    }

    public static float[] filledArray(float val, int len) {
        float[] x = null;

        if (len > 0) {
            x = new float[len];
            for (int i = 0; i < len; i++)
                x[i] = val;
        }

        return x;
    }

    public static int[] filledArray(int val, int len) {
        int[] x = null;

        if (len > 0) {
            x = new int[len];
            for (int i = 0; i < len; i++)
                x[i] = val;
        }

        return x;
    }
}

Related

  1. zeroPrefix(String str, int width)
  2. zeroPrepend(long num, int digits)
  3. ZeroRemover(String[] a)
  4. zeros(int n)
  5. zeros(int size)
  6. zeroString(int length)
  7. zeroString(int value)
  8. zeroSupply(String value, int len)
  9. zeroThrough(int max)