import java.io.*;
public class ByteArrayOutputStreamDemo
{
public static void main(String[] args)
{
String s = "abcdefghijklmnopqrstuvwxyz";
ByteArrayOutputStream bas = new ByteArrayOutputStream();
bas.writeBytes(s.getBytes());
byte[] b = bas.toByteArray();
for(int c: b)
System.out.print((char)c);
System.out.println();
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter