question: private static byte [ ] stringToByteArray ( String str ) { if ( str == null ) { return null ; } byte [ ] srcByte = str . getBytes ( ) ; int srcLength = srcByte . length ; byte [ ] result = new byte [ srcLength + 1 ] ; System . arraycopy ( srcByte , 0 , result , 0 , srcLength ) ; result [ srcLength ] = 0 ; return result ; }
target:  Returns this java string as a null-terminated byte array