Java String.getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)
Syntax
String.getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) has the following syntax.
@Deprecated public void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin)
Example
In the following code shows how to use String.getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) method.
//from w ww . jav a 2 s. co m
public class Main {
public static void main(String[] args) {
String str = "java2s.com";
System.out.println(str);
char[] chararr = new char[30];
str.getChars(2, 6, chararr, 0);
System.out.print("Value of character array : ");
System.out.println(chararr);
}
}
The code above generates the following result.