Math.sqrt()

public class Center
{
    public static void main(String[] args)
    {
        Picture pic = new Picture();
        pic.load("queen-mary.png");
        pic.draw();

        double centerX = pic.getWidth() / 2;
        double centerY = pic.getHeight() / 2;
        double radius = pic.getHeight() / 4;

        for (int x = 0; x < pic.getWidth(); x++)
        {
            for (int y = 0; y < pic.getHeight(); y++)
            {
                double distance = Math.sqrt((centerX - x)*(centerX - x) + (centerY - y)*(centerY - y));
                if (distance > radius)
                {
                    pic.setColorAt(x, y, Color.BLACK);
                }
            }
        }
    }
}
import java.util.Random;

public class test
{
    public static void main(String[] args)
    {
        Random generator = new Random(42);

        int numberOfSixes = 0;
        for(int i = 0; i < 101; i++)
        {
          int value = generator.nextInt(6) + 1;
          if(value == 6)
          {
            numberOfSixes++;
          }
        }
        System.out.println(numberOfSixes);
    }
}