Sep 28, 2012

String to Byte Array and Byte Array to String code in Java

       String to Byte Array  conversion  Logic and vice versa Byte Array to String in Java. When i came across such a situation to covert my String to Byte Array i tough it will be a complex logic.. But Java Libraries gives me a easy one line step that ease my job.


public byte[] stringToByte(String s) {
return s.getBytes();
}



public String byteToString(byte[] b) {
return new String(b);
}

People also Visited





No comments:

Post a Comment

Post a Comment

Note: Only a member of this blog may post a comment.