Java calculation for progressbar

I'm trying to come up with the calculation for the progressbar but can not seem to. The progressbar has a value of 0.0 to 1.0. What would be the calculation formula for this? Example: If I am wanting to display something for 5 seconds then, in theory, that should be 0.20 5 times (0.20, 0.40, 0.60, 0.80, 1.0) to make 1.0 with each loop. But how would that look in the java code?

Apr 25, 2025 - 17:24
 0
Java calculation for progressbar

I'm trying to come up with the calculation for the progressbar but can not seem to.

The progressbar has a value of 0.0 to 1.0.

What would be the calculation formula for this?

Example: If I am wanting to display something for 5 seconds then, in theory, that should be 0.20 5 times (0.20, 0.40, 0.60, 0.80, 1.0) to make 1.0 with each loop. But how would that look in the java code?