I have a Java program that has been converting a very large number from hexadecimal (55,732,656 digits) to its decimal equivalent. The only algorithm I know for doing that is O(n^2), so my program has been running for about four days, and it was only about 40% done an hour ago. A half hour ago something went wrong with my keyboard, and when I pressed a key, any key, nothing happened. I couldn't edit the Word file I was working on; I couldn't type a command or any input into any of my command windows; I couldn't do much of anything. So I restarted my computer. That fixed the problem with the unresponsive keyboard; now I can type and have what I type show up in the window I'm working on. But the downside is that I lost all four day's worth of calculation, translating my huge hexadecimal number into decimal.
Is there by any chance a Java exception that gets thrown when the computer starts to do a shutdown prior to a restart, that I could catch and handle by writing my intermediate data to disk, so that all my work on a program that is likely to last for ten or so days doesn't get lost? It'd be nice if I could write an exception handler into my code that keeps me from losing four days work like I just did.
Is there by any chance a Java exception that gets thrown when the computer starts to do a shutdown prior to a restart, that I could catch and handle by writing my intermediate data to disk, so that all my work on a program that is likely to last for ten or so days doesn't get lost? It'd be nice if I could write an exception handler into my code that keeps me from losing four days work like I just did.