View Javadoc
1 package jrre.unittests.datastructures; 2 3 public class ArrayManipulations { 4 5 public int average(int [] data){ 6 7 int total = 0; 8 9 for(int i=0;i < data.length;i++) 10 total += data[i]; 11 12 return (total / data.length); 13 14 } 15 16 public int [] sortArray(int [] data){ 17 18 QuickSorter sorter = new QuickSorter(); 19 20 jrre.api.java.lang.System.out.println("Source Data Set:"); 21 printArray(data); 22 23 sorter.quickSort(data, 0, data.length-1); 24 25 jrre.api.java.lang.System.out.println("Result Data Set:"); 26 printArray(data); 27 28 return data; 29 } 30 31 public void printArray(int [] data){ 32 33 jrre.api.java.lang.System.out.println(""); 34 35 for(int i=0;i < data.length;i++) 36 printDataPoint(data[i]); 37 38 jrre.api.java.lang.System.out.println(""); 39 } 40 41 public void printDataPoint(int dataValue){ 42 43 for(int i=0;i < dataValue;i++) 44 jrre.api.java.lang.System.out.print("*"); 45 46 jrre.api.java.lang.System.out.print("\n"); 47 } 48 49 public static void main(String [] args){ 50 51 int [] data = new int[10]; 52 53 for(int i=0;i < data.length;i++) 54 data[i]=(data.length-i); 55 56 ArrayManipulations manipulations = new ArrayManipulations(); 57 manipulations.sortArray(data); 58 59 } 60 61 } 62

This page was automatically generated by Maven