Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

multiplying two objects

 
alejandro piwowaro
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Campbell Ritchie
Sheriff
Pie
Posts: 49733
69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic