import java.nio.ByteBuffer;
import java.io.UnsupportedEncodingException;
public class MyClass {
public static void main(String args[]) throws UnsupportedEncodingException {
String s = "Java programming";
ByteBuffer bbuffer = ByteBuffer.wrap(s.getBytes("UTF-8"));
byte[] array = new byte[bbuffer.remaining()];
bbuffer.get(array);
bbuffer.rewind();
for (byte ch : array) {
System.out.print(ch + " ");
}
}
}
/*
run:
74 97 118 97 32 112 114 111 103 114 97 109 109 105 110 103
*/