private int lowerHeightMap(int x,int y,int z){
  for (--y; y >= 0; --y) {
    if (getType(x,z,y) != 0) {
      break;
    }
  }
  return y + 1;
}

private int lowerHeightMap ( int x , int y , int z ) { for ( -- y ; y >= 0 ; -- y ) { if ( getType ( x , z , y ) != 0 ) { break ; } } return y + 1 ; }
scan downwards to determine the new height map value .
