Here you can find the source of bytes2Long(byte[] bytes)
Parameter | Description |
---|---|
bytes | a parameter |
public static long bytes2Long(byte[] bytes)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from www .j a v a 2s .co m*/ * convert bytes to long. high byte store at left. * @param bytes * @return */ public static long bytes2Long(byte[] bytes) { long num = 0; for (int ix = 0; ix < bytes.length; ++ix) { num <<= 8; num |= (bytes[ix] & 0xff); } return num; } public static long bytes2Long(byte[] bytes, long defaultValue) { if (bytes == null) { return defaultValue; } else { return bytes2Long(bytes); } } }