Need help, not adding after 1024

There's probably a more elegant way to achieve the same result, but maybe something along these lines would work?

  finalEnergyDecimal = finalEnergyDecimal + accumulateEnergy;
  
  if (finalEnergyDecimal > 1) {
     finalEnergyValue += (int) finalEnergyDecimal;
     finalEnergyDecimal -= (int) finalEnergyDecimal;
  }

(store only the integer value in finalEnergyValue, and the decimal value in finalEnergyDecimal).

1 Like