protected double decode(int value,double lower,double upper,int nbits){
  int maxval=(int)(Math.pow(2,nbits) - 1);
  return value * ((upper - lower) / (maxval - 0)) + lower;
}

protected double decode ( int value , double lower , double upper , int nbits ) { int maxval = ( int ) ( Math . pow ( 2 , nbits ) - 1 ) ; return value * ( ( upper - lower ) / ( maxval - 0 ) ) + lower ; }
decode value from an nbits unsigned integer
