Results 1 to 2 of 2
- 03-10-2010, 05:45 AM #1
Member
- Join Date
- Dec 2009
- Posts
- 7
- Rep Power
- 0
Need help in calculating average value on this format ....
00:24:c3:31:2b:e0 -93
00:12:17:7b:33:04 -80
00:1f:27:55:f7:70 -70
00:1e:13:ee:3e:40 -85
00:24:c3:31:b8:80 -91
00:90:4c:60:04:02 -94
00:1b:0d:d6:6d:50 -70
00:1a:a2:dc:a0:60 -86
00:1e:c1:4c:c5:ce -94
00:24:c3:31:b8:80 -91
00:1e:c1:4c:c5:ce -94
00:1a:a2:dc:a0:60 -91
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, 04: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,
Where you read each line into the elements of this map of lists,Java Code: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.
Similar Threads
-
how to convert one format to another format
By mahipal_reddy621 in forum New To JavaReplies: 1Last Post: 12-02-2008, 10:21 AM -
Test score average
By ryn21 in forum New To JavaReplies: 11Last Post: 10-17-2008, 05:49 AM -
Calculate Average
By sthack99 in forum New To JavaReplies: 4Last Post: 06-13-2008, 11:09 AM -
sum,product,average program
By chitwood in forum New To JavaReplies: 7Last Post: 01-24-2008, 05:18 AM -
working out wrong average
By gemtez in forum New To JavaReplies: 4Last Post: 12-12-2007, 08:35 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks