Median Usage, Examples, Demos and Tutorials

Code Examples of Median

public static double getMedianTestScore(int testID)

throws SQLException

{

Logger

log = Logger.getLogger();

boolean

loggingEnabled = log.isLoggingEnabled();

Median

median = new Median();

ArrayList

arraylist = new ArrayList();

Connection

conn = getDefaultConnection();

try {

log.enableLogging( false );

PreparedStatement

ps = Utils.prepare

(

conn,

“select tk.score\n” +

“from TestTaking tk, LastTaking lt\n” +

“where tk.takingID = lt.takingID\n” +

“and tk.testID = ?\n”

);

ps.setInt( 1, testID );

ResultSet

rs = ps.executeQuery();

while( rs.next() )

{

arraylist.add(new Double(rs.getDouble(1)));

}

Utils.close(rs);

Utils.close(ps);

}

finally

{

log.enableLogging( loggingEnabled );

}

int

count = arraylist.size();

double

values[] = new double[ count ];

for ( int i = 0; i < count; i++){ values[ i ] = ((Double)arraylist.get(i)).doubleValue(); }return median.evaluate( values );}/***

* Format a double as a percentage, suitable for printing.

Copyright © 2011 www.androidadb.com. All rights reserved. All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc. Contact . See also:

|

|

|

Read More Post

STAY CONNECTED

Most Popular

Manifesting Your Dream Career: Finding Your Passion And Purpose
01 Aug

Manifesting Your Dream Career: Finding Your Passion And Purpose

Are you passionate about finding your dream career? Manifesting can help you align your career with your passions and purpose.

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service
27 Feb

Revolutionizing Your Ride: Expert Auto Service At Carolina Auto Service

Finding a reliable auto service provider is paramount in the bustling world of vehicle maintenance and repair. That's where Carolina

Floratam: The Robust Grass Solution From Council Growers SOD
25 Jan

Floratam: The Robust Grass Solution From Council Growers SOD

Floratam grass, a popular St. Augustine variety, has become a go-to choice for homeowners and landscapers seeking a lush, durable

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair
25 Jan

Carolina Mobile Autoservice: Your Go-To For Expert Brake Service Repair

For vehicle owners, the braking system is among the most critical components for safety and performance. Carolina Mobile Autoservice, a

Safeguarding Your Property: Expert Water Damage Services By MBC Capital
24 Jan

Safeguarding Your Property: Expert Water Damage Services By MBC Capital

Water damage can significantly impact homes and businesses, often leaving a trail of destruction and disruption in its wake. Understanding

Revanesse Lip Filler: The Secret To A Perfect Pout – Discover America’s New Favorite At Beauty From Ashes Aesthetics
19 Jan

Revanesse Lip Filler: The Secret To A Perfect Pout – Discover America’s New Favorite At Beauty From Ashes Aesthetics

In the ever-evolving world of cosmetic enhancements, there's a constant quest for the next big thing. The latest darling in