position 0 + 16 x position 1 + 16x16 x position 2...

255 will be
= 2 x 16 x 16 + 5 x 16 + 5
= 512 + 80 + 5
= 597

the same goes for numbers with more than 3 digits
4th digit x 16 x 16 x 16
5th digit x 16 x 16 x 16 x 16

so on...