intbubblesorter.java
来自「著名的uncle Bob的Agile software development的」· Java 代码 · 共 22 行
JAVA
22 行
public class IntBubbleSorter extends BubbleSorter
{
private int[] array = null;
public int sort(int [] theArray)
{
array = theArray;
length = array.length;
return doSort();
}
protected void swap(int index)
{
int temp = array[index];
array[index] = array[index+1];
array[index+1] = temp;
}
protected boolean outOfOrder(int index)
{
return (array[index] > array[index+1]);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?