Q:

Double variable with 16+ digits gives error: Integer Number too Large

The following code is designed to factorize a number typed into the variable x. 
public class testMod{
    public static void main(String[]args){
        double x = 11868681080091051216000;
        StringBuilder output = new StringBuilder("1 * ");
        for(double y = 2; y <= x; y++){
            while (x % y == 0) {
                System.out.print("Calculating... \n");
                String printNumber = y + " * ";
                x = x / y;
                output.append(printNumber);
                System.out.print(output.substring(0, output.length() - 2) + "\n");
            }
        }
    }
}

A:

The problem is that the compiler treats 11868681080091051216000 as an int, regardless of the attempt to assign it to a double. As such, it's out of range.
To specify a double literal, you can simply append D to the end – but do note that you'll lose precision this way:
double x = 11868681080091051216000D;
System.out.println(x); // prints 186868108009105E22

If you need the full precision, you can use a BigInteger instead, but you'll still need to specify that number in expressions that Java can handle, such as a product of its factors.

