Add to/fromByteArray helper to restore Java1.6 compatiblity