code: public static int[] distanceCalculator(int[] coords, double dist) {
          double angle;
          if ((coords[2] - coords[0]) == 0) {
              angle = Math.PI / 2;
          } else {
              angle = Math.atan(((double) coords[3] - (double) coords[1]) / ((double) coords[2] - (double) coords[0]));
          }
          int begin1X = (int) (Math.cos(angle + Math.PI / 2) * dist + coords[0]);
          int begin1Y = (int) (Math.sin(angle + Math.PI / 2) * dist + coords[1]);
          int begin2X = (int) (Math.cos(angle - Math.PI / 2) * dist + coords[0]);
          int begin2Y = (int) (Math.sin(angle - Math.PI / 2) * dist + coords[1]);
          int end1X = (int) (Math.cos(angle - Math.PI / 2) * dist + coords[2]);
          int end1Y = (int) (Math.sin(angle - Math.PI / 2) * dist + coords[3]);
          int end2X = (int) (Math.cos(angle + Math.PI / 2) * dist + coords[2]);
          int end2Y = (int) (Math.sin(angle + Math.PI / 2) * dist + coords[3]);
  
          return new int[]{begin1X, begin1Y, begin2X, begin2Y, end1X, end1Y, end2X, end2Y};
      }
docs: Gets the coordinates of two points (that represent a bond) and calculates
  for each the coordinates of two new points that have the given distance
  vertical to the bond.
  
  @param  coords  The coordinates of the two given points of the bond like this
  [point1x, point1y, point2x, point2y]
  @param  dist    The vertical distance between the given points and those to
  be calculated
  @return         The coordinates of the calculated four points