Create a Java or C# 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 to collisions. The application must display the positions of the spheres in real time. In addition, the 3D vector position of each sphere should be saved once every second for future plotting and simulation replay. The initial position and velocity for each sphere should be random, but constrained, each time the application is run. The camera should be positioned to see the entire cube environment, but it does not have to be adjustable by the user.