Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.*;

public class Main {

    public static void main(String[] args) {

        byte[] arrByte = new byte[1024];

        byte[] byteArray = new byte[] { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm' };

        InputStream is = new ByteArrayInputStream(byteArray);
        PushbackInputStream pis = new PushbackInputStream(is);
        try {
            pis.skip(1);

            for (int i = 0; i < byteArray.length - 1; i++) {

                arrByte[i] = (byte) pis.read();

                System.out.println((char) arrByte[i]);
            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}