What are the steps to using karatsuba multiplication? I have 2 rather large integers and they are crashing my java program. Using long(s) for ints and it still throws and exception error. Any thoughts of doing this manually?
Even though you don't give us much to go on (code snipet, stack trace, exact exception type, system being run on 32/64 bits), IF it's really because of the size of the ints you feed the algorithm, you should change the ints to some arbitrary sized integer class. Start looking at the link below with the BigInteger class.
You got an exception because something went wrong. To avoid the exception, don't do that.
Please understand that there is no such thing as "an" exception. Each exception has a detailed description, which includes a reference to the source line involved.
If you expect help, you have to ask a meaningful question. This means that you WILL include all the details: the description of the exception, as displayed by the Java runtime, the actual source line involved, ideally the values of all the variables participating in that line, and that's just in the hope somebody recognizes the conditions. Better still, give us a snippet of code in a static main() that produces the same exception in a "one line" example (excluding the syntactic saccharine required for boilerplate or setting up the values used). If not "one line", then the smallest example that exhibits the failure.
Without knowing what has been done to represent the multiprecision integer, and without any knowledge of what the exception was or the line of code that caused it, there is no way to suggest what might be wrong.
How many bits do you need? 64? 256?
Maybe you can help me. A couple hours ago I got a syntax error from the compiler. What did I do wrong? How can I fix it?
Would it help if I told you that it was in a for-each construct on a subclass of a generic collection?
I spent fifteen years in one newsgroup and I found two to five questions per day that looked like yours. I answered them the same way.