java - Homework: how to write own multiplication of big numbers? -


I want to multiply a large number of my project (maximum java.long) in my own BigNumber class as int [] . Actually I need to implement something like this:

  157 x 121 y ---- 157 Results 1 314 + result 2 157 + result 3 ------ 18997 final Result  

But how do I implement it?

I thought the result was zeros (3140, 15700) and adding them with the expansion of 2,3. But first I need to navigate between each of the y numbers and multiply it by every digit of x.

Fill the numbers.

  36 x 92 3 6 + ----- + ----- + | 2/5/9 | / | / | | / 7 | / 4 + ----- + ----- + | 0 / || 1/2 / | / | | / 6 | / 2 | + ----- + ----- +  

Add numbers to each diagonal Visit at least-important digits (lower right) more than (upper left).

  2 2 (at least-important) (6 + 1 + 4) = 11 (make it) 1, and move it to the next digit) 1 (5 + 7 + 0 + 1 (done) = 13 (make it 3, take 1) 3 2 +1 (recovered) = 3 3 (most important)  

Answer 3312

Create two-dimensional array of points.

Write some arguments to scrape the above diagonals.

This should work for arbitrarily large numbers (as long as you have left the memory).


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -