<pre>
public static void swap(int[] data, int x, int y)
	{
		int temp = data[x];
		data[x] = data[y];
		data[y] = temp;
	}



	public static void selectionSort(int[] data, int n)
	{
  		int i, j, min;
 
  		for (i = 0; i < n-1; i++)
  		{
			// Select the minimum element from the remaining
			// and swap into position i
    			min = i;

    			for (j = i+1; j < n; j++)
       				if (data[j] < data[min])
          				min = j;

    			swap(data, i, min);
  		}
	}

        public static void insertionSort(int[] data, int n)
        {
                for(int i = 1; i < n-1; i++)
                {
                        // This is the value that needs to be inserted
                        int value = data[i];

                        // Scan the first i elements, starting at the end
                        // and shifting them while scanning
                        int j = i-1;
                        while((j >= 0) && (data[j] > value))
                        {
                                data[j+1] = data[j];
                                j--;
                        }

                        data[j+1] = value;


                }
        }

</pre>
