aspose file tools*
The moose likes Beginning Java and the fly likes multiplying two objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "multiplying two objects" Watch "multiplying two objects" New topic
Author

multiplying two objects

alejandro piwowaro
Greenhorn

Joined: Sep 14, 2011
Posts: 1
Thers a class called BigInt and it has a size and digit. size is the number of digits in the integer that is entered and digit is an array that holds the integer.

I have to write a method that multiplies them. I tried using two for loops to go through each index and multiply them. I think one of my problems is that im storing the product too soon or just wrong.

any help or a push in the right direction would be appreciated.

this is what i have so far

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4546
    
    5

alejandro , welcome to the Ranch! We don't have too many rules here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites.

http://www.java-forums.org/new-java/48559-multiplying-two-objects.html


luck, db
There are no new questions, but there may be new answers.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38897
    
  23
Welcome to the Ranch
You have managed to do the only thing worse than using tabs for indenting; you have combined tabs and spaces. I have tried to tidy it up, and it looks better on my browser, but might not on yours.

You need to work out the algorithm first. Pencil and paper. How do you multiply 843756983296392 × 874235974305613856 on paper? Write it down, and write down instructions for how to do it.
Are you suffering any ArrayIndexOutOfBoundsExceptions?

And I see they were a lot more forthright about cross-posting on the other forum than here. But they are right to be forthright.
 
Consider Paul's rocket mass heater.
 
subject: multiplying two objects