All pastes #280607 Raw Edit

Someone

public text v1 · immutable
#280607 ·published 2006-12-16 01:06 UTC
rendered paste body
public class bubbleSort
{
	public static void main(String[] args)
	{
		int numItems = list.length;
		boolean notSorted = true;
		while (notSorted && (numItems >= 2))
		{
			notSorted = false;
			for (int i = 0; i < numItems - 1; ++i)
			{
				if( list[i] > list[i+1])
				{
					swapArrayItems(list, i, i+1);
					//a swap occurred so possibly not sorted
					notSorted = true;
				}
			}
			--numItems
		}
	}
		
}