Java String getBytes Example
String class getBytes method example
String class getBytes method example. This example shows you how to use getBytes method.This method Encodes this String into a sequence of bytes using the platform's default charset, storing the result into a new byte array.
Here is the code:
/**
* @(#) GetBytesString.java
*Program that Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array.
* @Version 01-May-2008
* @author Rose India Team
*/
public class GetBytesString
{
public static void main(String[] args)
{
String str1 = "Welcome to RoseIndia";
//Convert this String into bytes according to the platform's default character encoding, storing the result into a new byte array.
System.out.println(str1.getBytes());
}
} |
null
|