Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by gigakox ( 2 years ago )
package org.example;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
File file = new File("numbers.txt");
// PrintWriter printWriter = new PrintWriter(file);
Random random = new Random();
Scanner scannerFile = new Scanner(file);
Scanner scanner = new Scanner(System.in);
// for(int i = 0; i <= 100_000; i++){
// printWriter.println(random.nextInt(50));
// }
// printWriter.close();
ArrayList<Integer> arrayList = new ArrayList<>();
while(scannerFile.hasNext()){
arrayList.add(scannerFile.nextInt());
}
System.out.println(arrayList);
int amountOfThreads = 0;
while(true){
System.out.println("How many threads do you want (1-8)? ");
amountOfThreads = scanner.nextInt();
if(amountOfThreads >= 1 && amountOfThreads <= 8){
break;
}
else{
System.out.println("Wrong input!");
}
}
for(int i = 0; i < 8; i++){
Runnable myRunnable = () -> {
}
}
}
}
Revise this Paste