Here you can find the source of getVector(SensorEvent event)
public static double[] getVector(SensorEvent event)
//package com.java2s; //License from project: Apache License import java.math.BigDecimal; import android.hardware.SensorEvent; public class Main { public static double[] getVector(SensorEvent event) { return getVector(event.values); }//from w w w.j ava 2s. c om public static double[] getVector(float[] eventVals) { final double[] values = new double[3]; int axis = 0; for (double value : eventVals) { // scale to three decimal precision value = BigDecimal.valueOf(value).setScale(3, 0).doubleValue(); values[axis] = value; axis++; } return values; } }