title: Java: Calculating the angle between two points in degrees
body: <p>I need to calculate the angle in degrees between two points for my own Point class, Point a shall be the center point.</p>
  
  <p>Method:</p>
  
  <pre><code>public float getAngle(Point target) {
      return (float) Math.toDegrees(Math.atan2(target.x - x, target.y - y));
  }
  </code></pre>
  
  <p>Test 1: // returns 45</p>
  
  <pre><code>Point a = new Point(0, 0);
      System.out.println(a.getAngle(new Point(1, 1)));
  </code></pre>
  
  <p>Test 2: // returns -90, expected: 270</p>
  
  <pre><code>Point a = new Point(0, 0);
      System.out.println(a.getAngle(new Point(-1, 0)));
  </code></pre>
  
  <p>How can i convert the returned result into a number between 0 and 359?</p>