ArrayList<Double> speedInfo = new ArrayList<>(); do { speedInfo.add(input.nextDouble()); } while (speedInfo.size() != 2);