bubble sort in java

Java
public static void bubbleSort(int arr[])
{
	for (int i = 0; i < arr.length; i++) //number of passes
    {
		//keeps track of positions per pass      
    	for (int j = 0; j < (arr.length - 1 - i); j++) //Think you can add a -i to remove uneeded comparisons 
        {
          	//if left value is great than right value 
        	if (arr[j] > arr[j + 1])
            {
              	//swap values
            	int temp = arr[j];
              	arr[j] = arr[j + 1];
              	arr[j + 1] = temp; 
            }
        }
    }
}public static void BubbleSortShortSC(int[] array)
    {
        for(int i = 0; i < array.length - 1; i++)
        {
            boolean sorted = true;
            for (int j = 0; j < array.length - i - 1; j++)
            {
                if(array[j] < array[j+1])
                {
                    int temp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = temp;
                    sorted = false;
                }
            }
            if (sorted)
            	break;
        }
    }
Source

Also in Java: