title: How to find whether a point is lying inside a square or not in Java?
body: <p>I want to find whether a point lies inside a square or not. I have been given end coordinates of a diagonal of a square and I have found out the other diagonal's end coordinates.</p>
  
  <p>One method I could think of it was to solve it by using property of circumcircle. I have included all the points inside the circumcircle of the square but I cannot think of a method to exclude the extra points.</p>
  
  <p><strong>The edges are not parallel to any coordinate axis.</strong></p>
  
  <p>Is there any method to do it in java?</p>
  
  <p>Heres my part of code:</p>
  
  <pre><code>if(distance(x1,y1,x2,y2,j,i)&lt;=dd)
          A[i][j]=1;        
      else
          A[i][j]=0; 
  </code></pre>
  
  <p>x1,y1,x2,y2 are the coordinates of the diagonal of the square and dd is the length of diagonal and i,j are the coordinates greater than 0 and less than 100.
  I am using array to store the points satisfying the condition.</p>