Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.nio.ByteBuffer;
import java.nio.ByteOrder;

public class Main {
    public static long ReadlittleEndianLong(InputStream dis) throws IOException {
        byte[] bytes = new byte[8];
        int re = dis.read(bytes);
        if (re == -1) {
            return -1;
        }
        ByteBuffer bytebuffer = ByteBuffer.wrap(bytes);
        bytebuffer.order(ByteOrder.LITTLE_ENDIAN);
        long result = bytebuffer.getLong();
        return result;
    }
}