Java bubble sort

From , 5 Years ago, written in Java, viewed 216 times.
URL https://pastebin.vip/view/b4a52895
  1. package org.rut.util.algorithm.support;
  2. import org.rut.util.algorithm.SortUtil;
  3. /**
  4.  * @author treeroot
  5.  * @since 2006-2-2
  6.  * @version 1.0
  7.  */
  8. public class BubbleSort implements SortUtil.Sort{
  9.     /* (non-Javadoc)
  10.      * @see org.rut.util.algorithm.SortUtil.Sort#sort(int[])
  11.      */
  12.     public void sort(int[] data) {
  13.         int temp;
  14.         for(int i=0;i<data.length;i++){
  15.             for(int j=data.length-1;j>i;j--){
  16.                 if(data[j]<data[j-1]){
  17.                     SortUtil.swap(data,j,j-1);
  18.                 }
  19.             }
  20.         }
  21.     }
  22. }

Reply to "Java bubble sort"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website