All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vesalainen.lang.NumberRanges Maven / Gradle / Ivy

/*
 * Copyright (C) 2014 Timo Vesalainen
 *
 * 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 .
 */

package org.vesalainen.lang;

/**
 *
 * @author Timo Vesalainen
 */
public class NumberRanges
{

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        System.err.println("static final CharSequence[][] ByteRange = new String[][] {");
        print(Byte.MIN_VALUE, Byte.MAX_VALUE);
        System.err.println("static final CharSequence[][] ShortRange = new String[][] {");
        print(Short.MIN_VALUE, Short.MAX_VALUE);
        System.err.println("static final CharSequence[][] IntRange = new String[][] {");
        print(Integer.MIN_VALUE, Integer.MAX_VALUE);
        System.err.println("static final CharSequence[][] LongRange = new String[][] {");
        print(Long.MIN_VALUE, Long.MAX_VALUE);
        System.err.println("static final CharSequence[][] UnsignedIntRange = new String[][] {");
        print(0, -1, int.class);
        System.err.println("static final CharSequence[][] UnsignedLongRange = new String[][] {");
        print(0, -1, long.class);
    }

    private static void print(long min, long max)
    {
        print(min, max, null);
    }
    private static void print(long min, long max, Class type)
    {
        for (int radix=0;radix




© 2015 - 2024 Weber Informatics LLC | Privacy Policy