1731 Facit - bubble sort

import java.util.Random;
/*
 * @author Rikard Karlsson
 * @version 2015-04-23
 */
public class Numbers
{
  //fält
  private int [] numbers;
  private Random randomGenerator;

  //konstruktor
  public Numbers()
  { 
    numbers = new int [5];
    randomGenerator = new Random();
    makeRandomNumbers();     
  }   
  //metoder
  public void print()
  {
    for ( int i = 0; i < 5; i = i + 1 )
    {
      System.out.print(numbers[i] + ", ");
    } 
    System.out.println();
  }  
  public void makeRandomNumbers()   
  {
    for ( int i = 0; i < 5; i = i + 1 )
    {
      numbers[i] = randomGenerator.nextInt(90)+ 10;
    }
  }
  public void swap(int indexOne, int indexTwo)
  {
    int temp;
    temp = numbers[indexOne];
    numbers[indexOne] = numbers[indexTwo];
    numbers[indexTwo] = temp;      
  }
  public void bubblesort()
  {
    for (int j = 0; j < 5; j = j + 1)
    {
      for (int i = 0; i < 4; i = i + 1)
      {
        if (numbers[i] > numbers[i + 1])    
        {
          swap(i, i + 1);
          print();
        }
      }
    } 
  }   
}