Untitled

 avatar
unknown
java
4 years ago
959 B
3
Indexable
    import java.io.*;
import java.lang.*;
    import java.nio.charset.StandardCharsets;

    public class Main {

        public static void main(String[] args) {
            InputStream in = null;
            try {
                File f = new File("in.txt");
                in = new FileInputStream(f);
                byte[] bytes = new byte[in.available()];
                bytes = in.readAllBytes();
                for(int i = 0; i < bytes.length / 2; i++) {
                    System.out.write(bytes[i]);
                }
            }
            catch (IOException ex) {
                System.out.println(ex);
            }
            finally {
                try {
                    if(in != null) {
                        in.close();
                    }
                }
                catch (IOException ex) {
                    System.out.println(ex);
                }
            }
            System.out.flush();
        }
    }
Editor is loading...