private static void addVerticalSmallSpring(Path2D.Float path,int x0,int y1,int y2){
  int springHeight=2;
  int springWidth=2;
  int distance=Math.abs(y2 - y1);
  int numSprings=(distance / (springHeight));
  int leftOver=(distance - (numSprings * springHeight)) / 2;
  path.lineTo(x0,y1);
  path.lineTo(x0,y1 - leftOver);
  int count=0;
  if (y1 > y2) {
    for (int y=y1 - leftOver; y > y2 + leftOver; y-=springHeight) {
      int x=(count % 2 == 0) ? x0 - springWidth : x0 + springWidth;
      path.lineTo(x,y);
      count++;
    }
  }
 else {
    for (int y=y1 + leftOver; y < y2 - leftOver; y+=springHeight) {
      int x=(count % 2 == 0) ? x0 - springWidth : x0 + springWidth;
      path.lineTo(x,y);
      count++;
    }
  }
  path.lineTo(x0,y2 + leftOver);
  path.lineTo(x0,y2);
}

private static void addVerticalSmallSpring ( Path2D . Float path , int x0 , int y1 , int y2 ) { int springHeight = 2 ; int springWidth = 2 ; int distance = Math . abs ( y2 - y1 ) ; int numSprings = ( distance / ( springHeight ) ) ; int leftOver = ( distance - ( numSprings * springHeight ) ) / 2 ; path . lineTo ( x0 , y1 ) ; path . lineTo ( x0 , y1 - leftOver ) ; int count = 0 ; if ( y1 > y2 ) { for ( int y = y1 - leftOver ; y > y2 + leftOver ; y -= springHeight ) { int x = ( count % 2 == 0 ) ? x0 - springWidth : x0 + springWidth ; path . lineTo ( x , y ) ; count ++ ; } } else { for ( int y = y1 + leftOver ; y < y2 - leftOver ; y += springHeight ) { int x = ( count % 2 == 0 ) ? x0 - springWidth : x0 + springWidth ; path . lineTo ( x , y ) ; count ++ ; } } path . lineTo ( x0 , y2 + leftOver ) ; path . lineTo ( x0 , y2 ) ; }
add an vertical spring between ( x0 , y1 ) and ( x0 , y1 ) to the given path object
