import java.util.ArrayList; import java.util.List; import java.util.Random; public class Num01 { static List<Integer> numList = new ArrayList<>(); public static void createNum(){ List<Integer> list = new ArrayList<>(); for(int i = 0;i<10;i++){ list.add(i); } Random random = new Random(); int num = 0; for(int i = 0;i < 4;i++){ int index = random.nextInt(list.size()); if(index == 0) index++; numList.add(list.get(index)); num = num * 10 + list.get(index); list.remove(index); } System.out.println(num); } public static void main(String[] args) { createNum(); } }