I am learning the fundamentals of the Java language in the command prompt window. Hopefully a few of you people will know how to do this.

I have made a program that calculates random numbers for lottery tickets. What I need to do is remove any duplicates that show up in the output. Can someone tell me how I should go about this? (WARNING! This code is a little messy. I still have to polish it up. )

public class Super7 {

public static void main(String [] args) {

//Declare the variables
final int TICKET_PRICE = 2;
int [] boardNumber = new int [7];
int customerTickets;
int maxValue;
int maxIndex;
int customerPrice;
//Ask the user how many tickets he wishes to buy
System.out.print("How many tickets would you like to buy @ $2.00/each: ");
customerTickets = MyInput.readInt();

//Generate the numbers so that each ticket get 3 boards of 7 numbers from 1-49, depending on how many

//tickets he wishes to buy
for (int tickets = 0; tickets < customerTickets; tickets++) {
System.out.println("\n\t The numbers for your Super 7 ticket(s) are: ");
//populate the boardNumber array
for (int numberOfBoards = 0; numberOfBoards < 3; numberOfBoards ++) {
for (int board = 0; board < boardNumber.length; board++) {
boardNumber[board] = (int) (Math.random() * 49 + 1);
}//end for

for(int outerIndex = boardNumber.length-1; outerIndex>=1; outerIndex--) {
maxValue = boardNumber [outerIndex];
maxIndex = outerIndex;

for (int innerIndex = outerIndex - 1; innerIndex>=0; innerIndex--) {
if(maxValue < boardNumber[innerIndex]) {
maxValue = boardNumber[innerIndex];
maxIndex = innerIndex;
}//end if
}//end for

if (maxIndex != outerIndex) {
boardNumber[maxIndex] = boardNumber[outerIndex];
boardNumber[outerIndex] = maxValue;

}//end if
}//end for

for (int i = 0; i < boardNumber.length; i ++) {
System.out.print("\t" + boardNumber[i]);
}//end for
System.out.print("\n");
}//end for
}//end for
customerPrice = customerTickets * TICKET_PRICE;
System.out.println("\n Your cost for " + customerTickets + " ticket(s) is $" + customerPrice + ".00");
}//end main

}//end class



The MyInput.readInt() just reads the users input, it is what we have been given to get the users input.

Thanks for your help, and takeing the time to go through that code, it ain't pretty