I'm importing a large text file, 17 million digits long and I'm using this code:
BufferedReader reader = new BufferedReader(new FileReader("test2.txt"));
String line = reader.readLine();
System.out.println("Done");
BigInteger num = new BigInteger(line);
System.out.println("Done Again");
It loads the file pretty much instantly and prints out 'Done'
but it takes a long time (about an hour) for the String
to be converted into a BigInteger
, is there anything I can do to speed this up and quickly load the number?