Given acceleration from a accelerometer, how to modelize the position in space of the module?

I am getting the 3dimensional values of a grove pi module, acc_vector = (accX, accY, accZ)
each 100 milliseconds .
What I want is, using java, diplaying the movement that I make with the module...but my problem is not how to display it :p

For this I need to compute the value of the position position_vector = (x,y,z)
corresponding to the acceleration values. But I have no clue about how to do it.

Here is what I've tried, but it always gives odd results (initial position, speed and acceleration are (0,0,0) ):

It will depend on how you want to interpolate the acceleration. The easiest (but likely least accurate) would be to assume constant acceleration between samples. In that situation, your code for the xcomponent should resemble