code: public static void topBorderLabel(
              final LabelPositionCollector labels, final GeometryFactory geometryFactory,
              final Polygon rotatedBounds, final String unit, final double x,
              final AffineTransform worldToScreenTransform,
              final MathTransform toLabelProjection,
              final GridLabelFormat labelFormat) {
          Envelope envelopeInternal = rotatedBounds.getEnvelopeInternal();
          LineString lineString = geometryFactory.createLineString(new Coordinate[]{
                  new Coordinate(x, envelopeInternal.centre().y),
                  new Coordinate(x, envelopeInternal.getMaxY())
          });
          Geometry intersections = lineString.intersection(rotatedBounds.getExteriorRing());
  
          if (intersections.getNumPoints() > 0) {
              Coordinate borderIntersection = intersections.getGeometryN(0).getCoordinates()[0];
              double[] screenPoints = new double[2];
              worldToScreenTransform
                      .transform(new double[]{borderIntersection.x, borderIntersection.y}, 0, screenPoints, 0,
                                 1);
  
              double[] labelProj = transformToLabelProjection(toLabelProjection, borderIntersection);
              labels.add(new GridLabel(createLabel(labelProj[0], unit, labelFormat), (int) screenPoints[0],
                                       (int) screenPoints[1], TOP));
          }
      }
docs: CSOFF: ParameterNumber