@@ -0,0 +1,1771 @@
+import java.util.*;%0A%0Apublic class LottoNumbers %7B%0A/*%0AAs of Java8, this can be simplied to:%0A        int%5B%5D luckArray = new Random().ints(1, 59).distinct().limit(6).toArray();%0A        Arrays.sort(luckArray);%0A        for (int i=0; i%3CluckArray.length;i++)%0A            if(i!=5)%7B%0A                System.out.print(luckArray%5Bi%5D+%22-%22);%0A            %7Delse%0A        System.out.print(luckArray%5Bi%5D);%0A*/%0A    public static void main(String%5B%5D args) %7B%0A%0A        Random rand = new Random();%0A        int%5B%5D luckyArray = new int%5B6%5D;%0A%0A        //build array%0A        for (int i = 0; i %3C luckyArray.length; i++) %7B%0A%0A            int luckyNumber = rand.nextInt(54) + 1;%0A            luckyArray%5Bi%5D = luckyNumber;%0A        %7D%0A        Arrays.sort(luckyArray);%0A        //detect duplicates in the array%0A        for (int i = 0; i %3C luckyArray.length; i++) %7B%0A            if (i %3E 0 && luckyArray%5Bi%5D == luckyArray%5Bi - 1%5D) %7B%0A               // System.out.print(%22WE HAVE FOUND A DUPLICATE!%22);%0A                while (luckyArray%5Bi - 1%5D == luckyArray%5Bi%5D) %7B%0A                    luckyArray%5Bi%5D = rand.nextInt(54) + 1;%0A                %7D%0A            %7D%0A        %7D%0A        //sort the array before printing%0A        Arrays.sort(luckyArray);%0A        for (int i = 0; i %3C luckyArray.length; i++) %7B%0A            if (i %3E 0 && luckyArray%5Bi%5D == luckyArray%5Bi - 1%5D) %7B%0A               // System.out.print(%22WE HAVE FOUND A DUPLICATE!%22);%0A                while (luckyArray%5Bi - 1%5D == luckyArray%5Bi%5D) %7B%0A                    luckyArray%5Bi%5D = rand.nextInt(54) + 1;%0A                %7D%0A            %7D%0A        %7D%0A        %0A        Arrays.sort(luckyArray);%0A        for (int t = 0; t %3C luckyArray.length; t++) %7B%0A%0A            if (t != 5) %7B%0A                System.out.print(luckyArray%5Bt%5D + %22-%22);%0A            %7D else System.out.print(luckyArray%5Bt%5D);%0A        %7D%0A    %7D%0A%7D%0A

Create lottoNumbers.java