Skip to content

Instantly share code, notes, and snippets.

@affandes
Created March 21, 2020 03:15
Show Gist options
  • Save affandes/32a671f3ba3c8fe78485a0ff107c5b60 to your computer and use it in GitHub Desktop.
Save affandes/32a671f3ba3c8fe78485a0ff107c5b60 to your computer and use it in GitHub Desktop.
import java.io.ByteArrayInputStream;
public class ByteStream {
public static void main(String[] args) {
// Contoh input dari String
String teks = "ABC";
// Buat input stream
ByteArrayInputStream input = new ByteArrayInputStream(teks.getBytes());
// Salin input stream ke variabel
int first = input.read();
// Variabel siap digunakan
System.out.println("first = " + first);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment