Results 1 to 2 of 2
- 03-10-2010, 06:45 AM #1Member
- Join Date
- Dec 2009
- Rep Power
Need help in calculating average value on this format ....
The above is part of my .txt file, is there any method to calculate the average value for each ID ?
The first part is ID, second is value.
(Note: There are repeated same ID, so how to get those value and calculate average ?
Maybe the result will be :
00:24:c3:31:2b:e0 average : -88
00:12:17:7b:33:04 average : -90
- 03-11-2010, 05:21 AM #2
well, average is sum of all items divided by the total number of items.
perhaps where the first part is the 'key' in a hashtable, of lists,
Map<String, List<Integer>> itemsMap;
when you are done there will be exactly as many entries in the map as there are unique items.
and the entry for the map (the list, will contain as many numbers as there were found in the input set. so that lends to computing the average.
- By mahipal_reddy621 in forum New To JavaReplies: 1Last Post: 12-02-2008, 11:21 AM
- By ryn21 in forum New To JavaReplies: 11Last Post: 10-17-2008, 06:49 AM
- By sthack99 in forum New To JavaReplies: 4Last Post: 06-13-2008, 12:09 PM
- By chitwood in forum New To JavaReplies: 7Last Post: 01-24-2008, 06:18 AM
- By gemtez in forum New To JavaReplies: 4Last Post: 12-12-2007, 09:35 AM