Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.EOFException;

import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static final double readDouble(InputStream i) throws IOException {
        return Double.longBitsToDouble(readLong(i));
    }

    public static final long readLong(InputStream i) throws IOException {
        return ((long) (readInt(i)) << 32) + (readInt(i) & 0xFFFFFFFFL);
    }

    public static final int readInt(InputStream i) throws IOException, EOFException {
        InputStream in = i;
        int ch1 = in.read();
        int ch2 = in.read();
        int ch3 = in.read();
        int ch4 = in.read();
        if ((ch1 | ch2 | ch3 | ch4) < 0)
            throw new EOFException();
        return ((ch1 << 24) + (ch2 << 16) + (ch3 << 8) + (ch4 << 0));
    }
}