### Question:
Distance { public static double getSquaredDistanceToSegment( final double pFromX, final double pFromY, final double pAX, final double pAY, final double pBX, final double pBY ) { return getSquaredDistanceToProjection(pFromX, pFromY, pAX, pAY, pBX, pBY, getProjectionFactorToSegment(pFromX, pFromY, pAX, pAY, pBX, pBY)); }  static double getSquaredDistanceToPoint(
            final double pFromX, final double pFromY, final double pToX, final double pToY); static double getSquaredDistanceToLine(
            final double pFromX, final double pFromY,
            final double pAX, final double pAY, final double pBX, final double pBY
    ); static double getSquaredDistanceToSegment(
            final double pFromX, final double pFromY,
            final double pAX, final double pAY, final double pBX, final double pBY
    ); static double getSquaredDistanceToProjection(
            final double pFromX, final double pFromY,
            final double pAX, final double pAY, final double pBX, final double pBY,
            final double pProjectionFactor
    ); static double getProjectionFactorToLine(
            final double pFromX, final double pFromY,
            final double pAX, final double pAY, final double pBX, final double pBY
    ); static double getProjectionFactorToSegment(
            final double pFromX, final double pFromY,
            final double pAX, final double pAY, final double pBX, final double pBY
    );  }### Answer:
@Test public void test_getSquareDistanceToSegment() { final int xA = 100; final int yA = 200; Assert.assertEquals(0, Distance.getSquaredDistanceToSegment(xA, yA, xA, yA, xA, yA), mDelta); Assert.assertEquals(10 * 10, Distance.getSquaredDistanceToSegment(xA, yA, xA + 10, yA, xA + 10, yA), mDelta); Assert.assertEquals(20 * 20, Distance.getSquaredDistanceToSegment(xA, yA, xA, yA + 20, xA, yA + 20), mDelta); Assert.assertEquals(20 * 20, Distance.getSquaredDistanceToSegment(xA, yA + 20, xA, yA, xA + 100, yA), mDelta); Assert.assertEquals(10 * 10 + 30 * 30, Distance.getSquaredDistanceToSegment(xA - 10, yA - 30, xA, yA, xA + 100, yA), mDelta); Assert.assertEquals(100 * 100 + 70 * 70, Distance.getSquaredDistanceToSegment(xA + 200, yA - 70, xA, yA, xA + 100, yA), mDelta); Assert.assertEquals(7000 * 7000, Distance.getSquaredDistanceToSegment(xA + 200, yA - 7000, xA, yA, xA + 200, yA), mDelta); Assert.assertEquals(7000 * 7000, Distance.getSquaredDistanceToSegment(xA + 200, yA - 7000, xA, yA, xA + 1000, yA), mDelta); }