Use Math.abs in detecting energy difference