Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static long MASK_4F = +0x7FFFFFFFFFFFFFFFl; public static long read(long data, int start, int len) throws Exception { if (start < 0 || len < 1 || start + len >= 64 || data < 0) throw new Exception("Invalid Param!"); return ((data >> start) & (MASK_4F >> (63 - len))); } }