integer save into single bytes

the value returned was wrong compared to what was expected there fore I wrote it doesn't work...

Could be that your expectations were wrong. No input, no output, no way for us to know whether the code is wrong or your expectations are wrong.