File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes BigInteger Operations Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "BigInteger Operations" Watch "BigInteger Operations" New topic
Author

BigInteger Operations

jason tourne
Greenhorn

Joined: Apr 01, 2011
Posts: 10
I'm trying to add 3 integer values together through an array list to average them. What I have so far is down below, but need
help figuring out the blanks.

ArrayList<BigInteger> bigInts = new ArrayList<BigInteger>();
bigInts.add(new BigInteger("2333455236787456"));
bigInts.add(new BigInteger("234565764"));
bigInts.add(new BigInteger("979878678675"));

BigInteger average = new BigInteger("____");
for(int i = _____; i < bigInts.___(); i++){
average = average.____(bigInts._____(i));
}
BigInteger count = new BigInteger(""_____ bigInts._____());
average = average._____(count);
System.out.println(average);
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9946
    
    6

We generally don't just hand out a homework answer, and that is clearly what this is. So why don't you try, and tell us what you got?


Never ascribe to malice that which can be adequately explained by stupidity.
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

And please UseCodeTags when posting code. It will highlight your code making it much easier to read. You can edit your post with the button.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19


And please QuoteYourSources


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: BigInteger Operations
 
Similar Threads
a little BigInteger problem
Numerical methods using Java, Precision
convert BigInteger to integer
BigInteger
Convert Hex To Decimal