Here you can find the source of readLong(InputStream stream)
public static long readLong(InputStream stream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.io.InputStream; public class Main { private final static int BITS_IN_BYTE = 8; private final static int BITS_IN_LONG = 64; public static long readLong(InputStream stream) throws IOException { long result = 0; for (int i = 0; i < BITS_IN_LONG; i += BITS_IN_BYTE) result |= ((long) readByte(stream)) << i; return result; }/*from www. j a va 2 s .com*/ private static int readByte(InputStream stream) throws IOException { int result = stream.read(); if (result == -1) throw new IOException("Try to read from empty stream!"); return result; } }