string.getBytes()

String.getBytes() Creates a byte array by using sequence of bytes used in string.
Syntax
my_array=String1.getBytes()
Return value is an array of bytes

Here are some examples with output.
String my_str="abcd";
byte[] my_array=my_str.getBytes();

for(int i=0;i<my_array.length;i++) {
	System.out.println(my_array[i]);  
}
Output is here
97
98
99
100
All String functions

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer