Looks like FileInputStream doesn't read and / or FileOutputStreams don't write. But why? When I do it on my PC, both outputs look right. PS: Maybe the way I divide the bytes is not correct or could be better, but at this point my priority is to find out why the 2-nd condition is not met.