Check whether offset+count can be fulfilled by specified bytes.

Also add helper methods in Preconditions class for checking inputs to the public API.
Merge pull request #114 from square/jw/math

Check whether offset+count can be fulfilled by specified bytes.