Two Laptop Bag
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "multiplying two objects" Watch "multiplying two objects" New topic

multiplying two objects

alejandro piwowaro

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

Joined: May 03, 2008
Posts: 5115

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

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

Joined: Oct 13, 2005
Posts: 46437
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.
I agree. Here's the link:
subject: multiplying two objects
It's not a secret anymore!