I can't figure out how to ask if the size of the arraylist is equal to sqrt
This is what I have so far. I need to cofirm that the size of the array is equal to a square root. But I don't know enough to figure out how to do that. Maybe I shouldn't use an if?
Help?
Thank you
import java.util.ArrayList;
import java.util.Scanner;
public class SquareTester
{
private ArrayList <Integer> magic;
/**
* Constructor for objects of class SquareTester
*/
public SquareTester()
{
magic = new ArrayList<Integer>();
}
public static void main(String[] args)
{
Square magicSquare = new Square();
Scanner in = new Scanner(System.in);
System.out.println("Enter value for magic square: ");
int input = in.nextInt();
ArrayList<Integer> magic = new ArrayList<Integer>();
boolean continueLoop = true;
while (continueLoop)
{
magic.add(input);
System.out.println("Enter the value 000 when you are through ");
System.out.println("Enter next value ");
input = in.nextInt();
if(input == 000)
{
continueLoop = false;
}
}
double magicSize = Math.sqrt(magic.size());
if (?)
{
magicSquare = new Square();
magicSquare.add(input);
}
else
{
System.out.println("Not enough values ");
System.out.println("to make the magic square!");
}
}
}

