gt:             secondsPerUpdate *= 1 + percent / (max * 2);
context: import java.awt.Dimension;
  import java.awt.Graphics;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.event.WindowEvent;
  import java.awt.image.BufferedImage;
  
  import javax.swing.JFrame;
  import javax.swing.JMenu;
  import javax.swing.JMenuBar;
  import javax.swing.JMenuItem;
  import javax.swing.JPanel;
  
  /**
   * @author GitHub: jcstrang-edu
   * 
   * 
   *         this is the class where the magic happens System is a class that
   *         operates as the graphics and thread handler. System extends JFrame
   *         for easy access to its graphic manipulation methods System implements
   *         Runnable in order to allow an object of system to be run within a
   *         Thread
   *         
   *
   *         Copyright (C) 2015 Jonathan Strang
   * 
   *         This program is free software: you can redistribute it and/or modify
   *         it under the terms of the GNU Affero General Public License as
   *         published by the Free Software Foundation, either version 3 of the
   *         License, or (at your option) any later version.
   * 
   *         This program is distributed in the hope that it will be useful, but
   *         WITHOUT ANY WARRANTY; without even the implied warranty of
   *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   *         Affero General Public License for more details.
   * 
   *         You should have received a copy of the GNU Affero General Public
   *         License along with this program. If not, see
   *         <http://www.gnu.org/licenses/>.
   */
  public class System extends JPanel implements Runnable {
      /**
       * These are the True constants that are used within the code often or are
       * convention to add
       * 
       * serialVersionUID: This field is convention to add
       * 
       * NANO_SECONDS_PER_SECOND: In order to remove some magic numbers, I added
       * this constant.
       */
      private static final long serialVersionUID = 6451315602860406945L;
      public static final double NANO_SECONDS_PER_SECOND = 1_000_000_000D;
  
      /**
       * These are the instance constants that are necessary for code execution
       * but do not need to be changed within the foreseeable future.
       * 
       * TargetRPS: this is the target renders per second. This effectively sets
       * the maximum for frame rate; higher values have diminishing returns and
       * are a detriment to the accuracy of physics calculations.
       * 
       * width: this is the width of the physics environment window in pixels.
       * 
       * height: this is the height of the physics environment window in pixels.
       * 
       * scale: this is the visual scale of the physics environment window; this
       * variable has no influence on the physics calculations
       * 
       * passLayer: passLayer acts as the memory of all area where a body has
       * touched within the width and height of the physics area
       * 
       * drawLayer: drawLayer is what is literally shown onto the screen for the
       * user to see.
       * 
       * bodies: bodies contains the object representation of each celestial body in the simulator.
       * 
       * 
       * 
       * frame: this is the port for all of the visuals
       * 
       */
      private final int TargetRPS = 60;
      protected final double width, height, scale;
      private final int[] passLayer, drawLayer;
      protected final Body[] bodies;
      private final BufferedImage image; // this is the image form of the
                                         // simulator
      private final JFrame frame;
      private final Thread thread; // this is the simulator's thread
  
      private boolean running = false; // this is the thread status variable
      private int[] trueLayer; // this is the visual location of each object
      private double startTime, // this is the start time of the thread loop in
                                // nanoseconds
              endTime, // this is the end time of the loop in nanoSeconds
              deltaUpdateTime = 0, // this is the amount of time that has passed
                                   // since the last full update loop.
              secondsPerUpdate = 3.5E-6 / 1D, // this represents the time in
                                              // seconds that one
              // physics update would take
              timeElapsed = 0, // this is the total time that the simulator has
                               // analyzed
              deltaTime; // this variable is used to calculate the RPS of the
                         // system.
      private double Target_nSPR = 1D / TargetRPS;
  
      /**
       * FOR TESTING PURPOSES ONLY a simple main method that creates an object of
       * this class with width 450, height 350, and scale of 2. then, it initiates
       * the system's internal thread.
       * 
       * @param args
       *            this is necessary, but never used
       */
      public static void main(String[] args) {
  
          // System system=new System(2);
          System system = new System(400, 300, 2);
          system.initiate();
      }
  
      /**
       * makes the JFrame visible and starts the built-in thread (see 'run')
       * 
       * THIS MUST BE RUN FORTHE CODE TO DO ANYTHING
       */
      private void initiate() {
  
          frame.setVisible(true);
          thread.start();
      }
  
      /**
       * Original constructor-- keeping for now.
       * 
       * @param width
       *            the width of the actual physics environment
       * 
       * @param height
       *            the height of the actual physics environment
       * 
       * @param scale
       *            the visual scale of the physics environment
       */
      public System(int width, int height, int scale) {
  
          frame = new JFrame();
          this.width = width; // this and the following two variables are simple
                              // setters
          this.height = height;
          this.scale = scale;
          image = new BufferedImage((int) (width), (int) (height),
                  BufferedImage.TYPE_INT_RGB); // this is the image that is
                                               // rendered to the screen over and
                                               // over
          passLayer = new int[(int) (width * height)]; // this and the following
                                                       // two setters are used to
                                                       // set the size of the
                                                       // simulator's visual port
                                                       // to the physics.
          drawLayer = new int[(int) (width * height)];
          trueLayer = new int[(int) (width * height)];
          thread = new Thread(this); // this sets the on-board thread to operate
                                     // the run method that 'this' object has.
          setPreferredSize(new Dimension((int) (width * scale),
                  (int) (height * scale))); // sets the desired size of the
                                            // JFrame,
                                            // given the height, width and scales
                                            // specified
          setMinimumSize(new Dimension((int) (width * scale),
                  (int) (height * scale))); // these are technically redundant.
          setMaximumSize(new Dimension((int) (width * scale),
                  (int) (height * scale))); // these are technically redundant.
  
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // this kills the
                                                                // code abruptly
                                                                // upon exiting
                                                                // the
                                                                // visual port.
  
          JMenuBar frameMenuBar = new JMenuBar();
          JMenu frameMenu = new JMenu("scenario");
          frameMenuBar.add(frameMenu);
          JMenuItem stopButton = new JMenuItem("stop");
          stopButton.addActionListener(new ActionListener() {
              public synchronized void actionPerformed(ActionEvent e) {
                  stop();
              }
          });
  
          frameMenu.add(stopButton);
  
          frame.setJMenuBar(frameMenuBar);
          frame.add(this);
          bodies = ScenarioLibrary.scenario1(this); // .scenarioBinaryStar(this);
          // the line above is setting the scenario to use for the current
          // simulation, the commented code is another simulation i use often to
          // verify the accuracy of the physics.
  
          frame.setResizable(false); // this is so the user doesn't resize the
                                     // window;
          // frame.setUndecorated(true);
          frame.pack(); // this is convention to use, but is technically
                        // unnecessary.
      }
  
      /**
       * allows the code to be properly stopped
       */
      public synchronized void stop() {
          running = false;
          frame.dispatchEvent(new WindowEvent(frame, WindowEvent.WINDOW_CLOSING));
      }
  
      /**
       * the code gets real here this method is the thread method and once ran
       * does not ever stop until the code is forcefully stopped
       */
      public void run() {
  
          running = true; // this tells the object that it is executing the code
                          // below
          startTime = java.lang.System.nanoTime(); // setting the start time, in
                                                   // nanoSeconds, to the moment
                                                   // just before the execution of
                                                   // the loop to avoid
                                                   // mathematical issues with
                                                   // deltas
          while (running) {
              endTime = java.lang.System.nanoTime(); // this sets the time that
                                                     // the
                                                     // previous loop ended, in
                                                     // nanoSeconds
              deltaTime = (endTime - startTime) / NANO_SECONDS_PER_SECOND; // this
                                                                           // is
                                                                           // the
              // difference in
              // time from the
              // beginning and
              // end of the
              // loop, in
              // nanoSeconds
              deltaUpdateTime += deltaTime;
              startTime = endTime; // this sets the start of the current loop as
                                   // the end of the last loop
  
              while (deltaUpdateTime >= secondsPerUpdate) { // this loop will
                                                            // continue on
                  // until enough updates have
                  // een done to satisfy the
                  // time the previous loop
                  // lost to updating
                  update(secondsPerUpdate); // the actual update method
                  deltaUpdateTime -= secondsPerUpdate; // this removes the updates
                  // completed from the queue
              }
              render(); // this calls the render method, whcih controls all of the
                        // visual aspects of the simulator, it will execute once
                        // per thread loop
              level();
          }
      }
  
      /**
       * experimental code-- this causes the oscillatory quality of time
       */
      public void level() {
          double percent = deltaTime / Target_nSPR;
          if (percent < 1D) {
              percent = -1 / percent;
          }
          double max = TargetRPS;
          if (percent >= -max && percent <= max
                  && (percent >= 2 || percent <= -2)) {
  