/* decimals and array examples Copyright (C) 2009 Vegard Hammerseth (http://vegard.hammerseth.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. v1.0.0 */ class numbers { public static void main (String[] args) throws Exception { /* define array */ double[] d = { 123.345, 3243, 32156, 0.2354, 124.1 }; System.out.println("Task a)\n"); /* print array */ for (int x=0;x<5;x++) { System.out.println(d[x]); } System.out.println("\n\nTask b)\n"); /* print and format array */ for (int x=0;x<5;x++) { System.out.format("%010.2f%n",d[x]); } } }