question: public static final void writeByteArrayXml ( byte [ ] val , String name , XmlSerializer out ) throws XmlPullParserException , IOException { if ( val == null ) { out . startTag ( null , "null" ) ; out . endTag ( null , "null" ) ; return ; } out . startTag ( null , "byte-array" ) ; if ( name != null ) { out . attribute ( null , "name" , name ) ; } final int N = val . length ; out . attribute ( null , "num" , Integer . toString ( N ) ) ; StringBuilder sb = new StringBuilder ( val . length * 2 ) ; for ( int i = 0 ; i < N ; i ++ ) { int b = val [ i ] ; int h = b > > 4 ; sb . append ( h >= 10 ? ( 'a' + h - 10 ) : ( '0' + h ) ) ; h = b & 0xff ; sb . append ( h >= 10 ? ( 'a' + h - 10 ) : ( '0' + h ) ) ; } out . text ( sb . toString ( ) ) ; out . endTag ( null , "byte-array" ) ; }
target:  Flatten a byte[] into an XmlSerializer.  The list can later be read back with readThisByteArrayXml().