File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BigInteger Operations

 
jason tourne
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 12015
24
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Henry Wong
author
Marshal
Pie
Posts: 20823
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic