Ok so I have to create a Java application that simulates a minimum of 3 spheres moving through a frictionless environment with gravity. The environment should be a confined cube area for the spheres to collide and respond. The application does need to display the positions of the spheres in real time, but the 3D vector positions should be saved for each sphere to an output file for future plotting. Set initial velocities and positions and run the simulation for at least 100 iterations. Design your application such that collisions and their associated responses will occur during the simulation.

I got the pseudocode for this I think but I cant get it into java code for the life of me.

I get most of it but I cant seam to get it into code.void main() { //variables needed by the sim Vector3D cur_S[2*N]; //S(t+delta_t) Vector3D prior_S[2*N]; Vector3D S_derivs[2*N]; float mass[N]; float t; float delta_t; //set current state to initail conditions for(i = 0; i < N; i++){ mass[i] = mass of particle i; cur_S[2*i] = particle i initial linear momentum; sur_S[2*i+1] = particle i initial position; } while (game simulation is running){ DoPhysicisSimulationStep(delta_t); for (i = 0; i < M; i ++){ Render particle i at postion cur_S[2*i +1]; } } //update physics void DoPhysicisSimulationStep(delta_t){ copy cur_S to prior_s //calculate the stae derivative vector for(i = 0; i < N; i++){ S_derivs[2*i] = CalcForce(i); S_derivs[2*i+1] = prior_S[2*i] / mass[i]; } //integrate the equations of motion ExplicitEuler(2*N, cur_S, prior_S, S_derivs, delta_t); t = t+ delta_t; } }