Given any positive range, count the values that are complete squares import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Please choose the minimum of your range: ");
        double minimum = scanner.nextInt();
        System.out.println("Please choose the maximum of the range: ");
        double maximum = scanner.nextInt();
        List&lt;Double&gt; list = new ArrayList&lt;&gt;();
        List&lt;Double&gt; doubles = new ArrayList&lt;&gt;();
        int sum = 0;
        for (double x = minimum; x &lt;= maximum; x++) {
            list.add(x);
        }
        for (int i = 0; i &lt; list.size(); i++) {
            double sqrt = Math.sqrt((i));
            doubles.add(sqrt);
        }
        for (Double value : doubles) {
            if (value.doubleValue() == value.intValue()) {
                sum += 1;
            }
        }
        System.out.println(sum);
    }
}
Your algorithm is inefficient:


Floating-point arithmetic is slower than integer arithmetic.
To find all the perfect squares in a range, you need only find the square root of the minimum (and round up) and the square root of the maximum (and round down).


You should be able to find the answer in constant time, with no looping.