I am working with very large strings whose length range from 0 to 2*10^5.
When I try to print the strings on the console or using command line via System.out.println
, nothing shows up. Only strings/substrings with 4096 characters show up. Also, I get no errors.
I also tried to print the characters one at a time using System.out.print(chararray[i])
but to no avail.
I even tried tried to use the below but it did not work.
StringWriter stringWriter = new StringWriter();
BufferedWriter bufferedWriter = new BufferedWriter(stringWriter);
bufferedWriter.write(str); //does not display
StringBuilder sb = new StringBuilder(str);
System.out.println(sb); //does not display
Displaying is important here since I am submitting my program on HackerRank and my program does not pass the test case due to this issue.
Can anyone please help?
Note: I know the strings are being stored properly since I was able to verify their lengths using str.length();