Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes Java code for calculating 95 percentile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Java code for calculating 95 percentile" Watch "Java code for calculating 95 percentile" New topic
Author

Java code for calculating 95 percentile

Ashu Bharadwaj
Greenhorn

Joined: Nov 16, 2010
Posts: 20
Hi,

Which is the best solution for calculating 95th Percentile: calculating in Java code or in SQL. Need efficient way. The input file is large.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

In general I would say you should do the calculation in the database if it's possible.
Ashu Bharadwaj
Greenhorn

Joined: Nov 16, 2010
Posts: 20
Thanks Paul for your reply.
Ashu Bharadwaj
Greenhorn

Joined: Nov 16, 2010
Posts: 20
Can you please provide algorithm for calculating 95th percentile
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38519
    
  23
Ashu Bharadwaj wrote:Can you please provide algorithm for calculating 95th percentile
No. We do not know how your data are organised, so how should we know how to calculate the 95th centile? Can’t you order the data, count them, and then iterate the data to 95% of the count?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java code for calculating 95 percentile