I'm not sure what you mean by "calculate the value of 255". Are you doing something on multiple things, or just one? You mention "for each" and "of the total of 255", so I think there's some context that's missing.
Could you explain your problem a bit more?