public static String getAverageHeight(final GeoData geo, final boolean onlyFullReadings) {
        // remember new altitude reading, and calculate average from past MAX_READINGS readings
        if (geo.hasAltitude() && (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || geo.getVerticalAccuracyMeters() > 0.0)) {
            altitudeReadings[altitudeReadingPos] = getAltitude(geo);
            altitudeReadingPos = (++altitudeReadingPos) % altitudeReadings.length;
        }
        double averageAltitude = 0;
        int countReadings = 0;
        for (double altitude : altitudeReadings) {
            averageAltitude += altitude;
            if (altitude != 0) {
                countReadings++;
            }
        }
        averageAltitude /= altitudeReadings.length;
        return averageAltitude == 0 || (onlyFullReadings && countReadings < 5) ? "" : Formatter.SEPARATOR + (countReadings < 5 ? "~ " : "") + Units.formatElevation((float) averageAltitude);
    }
returns a formatted height string, empty, if height==0
main/src/main/java/cgeo/geocaching/utils/GeoHeightUtils.java