package com.futurice.freesound.feature.common;

import android.graphics.Bitmap;
import android.support.annotation.NonNull;
import android.util.Log;

public abstract class WaveformExtractor {

    private static final String TAG = WaveformExtractor.class.getSimpleName();

    public final float[] extract(@NonNull final Bitmap bitmap) {
        final long debugStartTime = System.currentTimeMillis();

        final int width = bitmap.getWidth();
        final float centreLine = (float) bitmap.getHeight() / 2f;
        final float[] normalizedAmplitudes = new float[width];
        //  Arrays.fill(normalizedAmplitudes, 0f); // assume no amplitude

        for (int x = 0; x < width; x++) {
            for (int y = 0; y < centreLine; y++) {
                if (isWaveform(bitmap, x, y)) {
                    normalizedAmplitudes[x] = (centreLine - y) / centreLine;
                    break; // next sample in x.
                }
                normalizedAmplitudes[x] = 0;
            }
        }
        Log.d(TAG,
              "Waveform extraction took: " + (System.currentTimeMillis() - debugStartTime) + " ms");
        return normalizedAmplitudes;
    }

    protected abstract boolean isWaveform(@NonNull final Bitmap bitmap,
                                          final int x,
                                          final int y);

}

@@ -572,82 +572,8 @@
 th%5D;
-%0A        //  Arrays.fill(normalizedAmplitudes, 0f); // assume no amplitude
 %0A%0A  
@@ -858,53 +858,8 @@
   %7D%0A
-                normalizedAmplitudes%5Bx%5D = 0;%0A
     

Remove unnecessary assignment