Convert String to byte Array - Java Language Basics

Java examples for Language Basics:String

Description

Convert String to byte Array

Demo Code


public class Main {
        public static void main(String args[]){
                String str = "Hello World";
               /*www  .java  2s  .co  m*/
                byte[] bytes = str.getBytes();
        }
}

Related Tutorials