Skip to main content
added 206 characters in body
Source Link
user100443
user100443

Java 11, repeat error message [231 - 1] times

Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

throw new Error("fatal".repeat(Integer.MAX_VALUE/5));

String's Maximum length in Java is Integer.MAX_VALUE i.e. == 231 - 1, or less, it depends on server max memory size and other conditions otherwise it produces OutOfMemoryError.

You can return something like this. It is not the error itself, but the error message:

for(int i=0;i<Integer.MAX_VALUE;i++){
    String m="fatal"+i;
    out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
}
  1. You can throw some Error with the certain message, for example:

    throw new Error("fatal".repeat(Integer.MAX_VALUE/5));
    

    Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

  2. You can return something like this. It is not the error itself, but the error message:

    for(int i=0;i<Integer.MAX_VALUE;i++){
        String m="fatal"+i;
        out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
    }
    

Java 11, repeat error message [231 - 1] times

Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

throw new Error("fatal".repeat(Integer.MAX_VALUE/5));

String's Maximum length in Java is Integer.MAX_VALUE i.e. == 231 - 1, or less, it depends on server max memory size and other conditions otherwise it produces OutOfMemoryError.

You can return something like this. It is not the error itself, but the error message:

for(int i=0;i<Integer.MAX_VALUE;i++){
    String m="fatal"+i;
    out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
}

Java 11, repeat error message [231 - 1] times

String's Maximum length in Java is Integer.MAX_VALUE i.e. == 231 - 1, or less, it depends on server max memory size and other conditions otherwise it produces OutOfMemoryError.

  1. You can throw some Error with the certain message, for example:

    throw new Error("fatal".repeat(Integer.MAX_VALUE/5));
    

    Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

  2. You can return something like this. It is not the error itself, but the error message:

    for(int i=0;i<Integer.MAX_VALUE;i++){
        String m="fatal"+i;
        out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
    }
    
added 296 characters in body
Source Link
user100443
user100443

Java 11, repeat error message [(2[231 - 1) / (length + 1)]1] times

Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

throw new Error("fatal".repeat(Integer.MAX_VALUE/775));

Try it online!

Number of times to repeatString's Maximum length in Java is Integer.MAX_VALUE / (5 + 1)i.e. == 231 - because "fatal" is 5 chars. In general1, or less, it depends on server max memory size and other conditions otherwise it produces OutOfMemoryErrorOutOfMemoryError.

You can return something like this. It is not the error itself, but the error message:

for(int i=0;i<Integer.MAX_VALUE;i++){
    String m="fatal"+i;
    out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
}

Java 11, repeat error message [(231 - 1) / (length + 1)] times

throw new Error("fatal".repeat(Integer.MAX_VALUE/77));

Try it online!

Number of times to repeat is Integer.MAX_VALUE / (5 + 1) - because "fatal" is 5 chars. In general, it depends on server max memory size otherwise it produces OutOfMemoryError.

Java 11, repeat error message [231 - 1] times

Number of times to repeat is Integer.MAX_VALUE / 5 - because "fatal" is 5 chars.

throw new Error("fatal".repeat(Integer.MAX_VALUE/5));

String's Maximum length in Java is Integer.MAX_VALUE i.e. == 231 - 1, or less, it depends on server max memory size and other conditions otherwise it produces OutOfMemoryError.

You can return something like this. It is not the error itself, but the error message:

for(int i=0;i<Integer.MAX_VALUE;i++){
    String m="fatal"+i;
    out.println(m.repeat(Integer.MAX_VALUE/m.length()-1));
}
added 4 characters in body
Source Link
user100443
user100443

Java 11, repeat error message [2[(231  -1 1) / (length + 1)] times

throw new Error("fatal".repeat(Integer.MAX_VALUE/77));

Try it online!

Number of times to repeat is Integer.MAX_VALUE / (5 + 1) - because "fatal" is 5 chars. In general, it depends on server max memory size otherwise it produces OutOfMemoryError.

Java 11, repeat error message [231-1 / (length + 1)] times

throw new Error("fatal".repeat(Integer.MAX_VALUE/77));

Try it online!

Number of times to repeat is Integer.MAX_VALUE / (5 + 1) - because "fatal" is 5 chars. In general, it depends on server max memory size otherwise it produces OutOfMemoryError.

Java 11, repeat error message [(231  - 1) / (length + 1)] times

throw new Error("fatal".repeat(Integer.MAX_VALUE/77));

Try it online!

Number of times to repeat is Integer.MAX_VALUE / (5 + 1) - because "fatal" is 5 chars. In general, it depends on server max memory size otherwise it produces OutOfMemoryError.

added 241 characters in body
Source Link
user100443
user100443
Loading
added 137 characters in body
Source Link
user100443
user100443
Loading
Source Link
user100443
user100443
Loading