Android examples for java.lang:array
Calculate root Mean Squared for short array
import android.content.Context; import android.content.pm.PackageManager; import android.media.MediaRecorder; import android.os.Environment; import android.util.Log; import java.io.IOException; import java.io.PrintWriter; public class Main{ public static double rootMeanSquared(short[] nums) { double ms = 0; for (int i = 0; i < nums.length; i++) { ms += nums[i] * nums[i];// w w w. j ava 2 s . co m } ms /= nums.length; return Math.sqrt(ms); } }