I
I
isxaker2014-05-01 19:46:37
Java
isxaker, 2014-05-01 19:46:37

How to speed up the output of a very large number to the console?

I have a very large number (number length is 200000 digits). I print it to the console like this:
System.out.println(myBigInt);
or
System.out.println(String.valueOf(myBigInt));
This takes me about 5 seconds. I need to reduce the time it takes to print such a number to the console. Any ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Moseychuk, 2014-05-01
@isxaker

With such volumes of data, the bottleneck is the terminal itself, it simply does not have time to display the data. Try redirecting the output to a file.
UPD: Here is a proposed method that is about 10 times faster than toString

P
Puma Thailand, 2014-05-02
@opium

Use more literate output, without that string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question