package com.bernard.mcqinator.inutil;

import java.text.DecimalFormat;

/**
 * @author samy
 * @date on 23/07/17.
 */

public final class NumberInutil {

    private static final DecimalFormat zero19 = new DecimalFormat("0000000000000000000");

    /**
     *
     * @author JohnS from stackoverflow
     */
    public static String toUnsignedString(long x) {
        if (x >= 0)
            return "0" + zero19.format(x);
        else if (x >= -8446744073709551616L)
            return "1" + zero19.format(x + 8446744073709551616L);
        else
            return "09" + (x - 9000000000000000000L);
    }

    public static int exclude(int n,int toExclude){
        return (n < toExclude)?n:n+1;
    }

}
