public class Main
{//来自 n o w j a v a . c o m
public static void main(String[] args)
{
int[] array = {0, 0, 0, 1, 0, 0, 1, 2, 4, 2, 1};
System.out.println("Grade distribution:");
// for each array element, output a bar of the chart
for (int counter = 0; counter < array.length; counter++)
{
// output bar label ("00-09: ", ..., "90-99: ", "100: ")
if (counter == 10)
System.out.printf("%5d: ", 100);
else/*来自 时代Java - nowjava.com*/
System.out.printf("%02d-%02d: ",
counter * 10, counter * 10 + 9);
// print bar of asterisks
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。