Java tutorial
//package com.java2s; public class Main { private static int getRawAmplitude(byte[] data, int len) { if (len <= 0 || data == null || data.length <= 0) { return 0; } int sum = 0; for (int i = 0; i < len; i++) { sum += Math.abs(data[i]); } return sum / len; } }