java - Printing BigIntegers to text files -
I'm calculating a very large factorial in Java. However, it takes a lot of time when I try to write them in text files. I am using this method to print numbers.
PrintWriter author = new print publisher (index + "! .txt", "UTF-8"); Writer.println (number); Writer.close ();
10,000 prints! The text file is 194 ms, the file size is 35.7 kb.
100,000 Printing! 24,314 ms in a text file, the file size is 456.6 kb.
I think the speed of this file size is very slow. How can I print BigIntegers in a few seconds with millions of digits? Are there fast methods or any way I can customize it?
When you see BigInteger is caused by ToString (), the file is not written in writing.
Conversion of Leving Bigentege in the sequence of decimal (or any other basis) is a cumbersome process, including the Luong division of Luong-ing [] by base and resulting string in a circumstantial way, Even using stringbirders. (I have just checked: 1.8 has used a better algorithm, but 35k or 456k points still have to go a long way.)
I went into this problem once and wrote a BigIntega Finish, if you choose the option for any other library, make sure that it works to return a new object instead of modifying one object. If you expect a consistent / long conversion for decimal / string, try displaying the number that is integral to 10.
Comments
Post a Comment