I haven’t tested it, but wrote using Scanner docs
Scanner sc = new Scanner(System.in);
while(sc.hasNext()) {
String next = sc.next();
if("q".equals(next)) break;
float value = new Float(next);
System.out.println("Float: "+value);
}
2
solved how to read float array from command line in java? [closed]