CSS font stacks, developer FAQs & web standards

Your banner ad here

Data recovery software tools & file recovery utilities to recover lost data

WestNIC provides reliable web hosting services

Site navigation below

This FAQ answers one of over 700 Web development questions submitted by Code Style readers. Sign-up to our premium content service to view the full answer.

Preliminary answer (stub article)

A: Assuming you have data values in a Java storage structure, the key part of the process is to iterate through the values, check and store the minimum and maximum values, the running total and number of data points. Lets take the simple case of an iterator over a set of DataPoint objects that have an int getValue() method.

This example has int variables for max, min, count, sum and a temporary dataValue. The initial value for max is set to Integer.MIN_VALUE so that any given value should exceed it, and min is set to Integer.MAX_VALUE. A float type is specified for the mean variable since integer division is likely to result in a fraction and the decimal part should be preserved.

premium content omitted

Sign up for premium content now Access all premium content for $50: sign-up below.
How can I calculate minimum, maximum and average using Java?

Premium content subscription

Come inside, access hundreds of premium content answers. One payment grants life membership to hundreds of developer FAQs.

Premium Content: $50 life membership

Membership payment: $50

* You do not need a PayPal account to complete payment.

Your security

The PayPal service allows you to pay securely and independently in your own currency. Payments are billed to Metacentric Internet Limited. We never handle your credit card details.

Why pay for premium content?

Direct access to hundreds of answers to common Web development questions with full working examples and links to other Web resources. Your subscription provides full answers to all premium content questions including those listed below, plus:

Java programming FAQ: premium questions

Java threads FAQ: premium questions

Java inheritance FAQ: premium questions

Java modifiers FAQ: premium questions

Java command line FAQ: premium questions

Java interface design FAQ: premium questions

Java language FAQ: premium questions

Java API FAQ: premium questions

Java strings FAQ: premium questions

JDBC FAQ: premium questions

Java objects FAQ: premium questions

Java static context FAQ: premium questions

Java abstract classes FAQ: premium questions

Java compiler FAQ: premium questions

Java utility classes FAQ: premium questions

Java I/O FAQ: premium questions

Java networking FAQ: premium questions

Java servlets FAQ: premium questions

Servlet containers FAQ: premium questions

Add this page to your chosen social bookmarking service

Style warning, please read

Home · CSS · Java · Javascript · HTML · Help · Log