我需要将秒的 int 值转换为字节,具体取决于原始值的 % 值

I need to convert an int value of seconds into a byte depenting on the % value of the original Value

让我澄清一下。 我有一个 3600 的 int 值。计时器开始计时。我现在有 3000。与原始值相比是多少,但以字节为单位 (0-255)

所以原值3600。现在 HALF 1800 当前值应该是一个字节的一半。

更多示例: 600Starting value ---> Current value is now 500. 这给出了大约 208 的字节值。

线性相关性:

bytevalue = 255 * currentvalue / maxvalue