title: How to determine if a square is inside a rectangle?
body: <p>Higuys,</p>
  
  <p>In Java, I wonder how can I determine if a square is inside a rectangle, or touching at the edges or touching at one corner, if these are given:</p>
  
  <ul>
  <li>x and y coordinates of the square, width of the square</li>
  <li>x and y coordinates of the rectangle, width &amp; length of the rectangle</li>
  </ul>
  
  <p>I know I have to use Math.abs() and find the x and y coordinate differences, but I could not formulate the problem mathematically.</p>
  
  <p>All data types are doubles, by the way.</p>
  
  <p>Even if you don't know Java, your ideas about mathematical formulation of this problem would be much appreciated.</p>
  
  <p>Thanks in advance.</p>