Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.hardware.SensorEvent;

public class Main {
    public static double getAcceleration(SensorEvent event) {
        final float x = event.values[0];
        final float y = event.values[1];
        final float z = event.values[2];
        double sqrt = Math.sqrt(Math.abs(x * x) + Math.abs(y * y) + Math.abs(z * z));
        return sqrt;
    }
}