class BubbleSort
{
   static void performBubbleSortOn(int[] f)
   {
      boolean getauscht = true;

      while(getauscht)
      {
         getauscht = false;

         //Testen, ob irgendwo noch etwas getauscht 
         //werden muss
         for(int i = f.length-1; i > 0; i--)
         {
            if(f[i] < f[i-1])
            {
               int h  = f[i];
               f[i]   = f[i-1];
               f[i-1] = h;
               getauscht = true; 
            }
         }
      }
   }

   static void printArray(int[] a)
   {
      for(int i = 0; i < a.length; i++)
      {
         System.out.print(a[i] + " ");
      }
      System.out.print("\n");
   }

   public static void main(String[] args)
   {
      int[] folge = {13,4,15,3,16,12,2,1,51,26,11};
      
      printArray(folge);

      performBubbleSortOn(folge);

      printArray(folge);
   }
}
