A byte is coded on 8 bits, so the maximum is 255 hence the strange
results below :

irb> 8 * 8 * 7 + 8 * 7 + 7
=> 511
irb> "\777".inspect
=> "\377"
irb> "\777"[0]
=> 255
irb> "\377"[0]
=> 255

\777 is invalid and is truncated to \377.