public long getMaxVal() {
   if (type instanceof SignedBitFieldType) {
     BitFieldType bitField = (BitFieldType) type;
     return (1 << bitField.getLength() - 1) - 1;
   }
   if (type instanceof BitFieldType) {
     BitFieldType bitField = (BitFieldType) type;
     return (1 << bitField.getLength()) - 1;
   }
   if (type instanceof StdIntegerType) {
     StdIntegerType integerType = (StdIntegerType) type;
     return integerType.getUpperBound().longValue();
   }
   throw new RuntimeException("type of field '" + param.getName() + "' is not a simple type");
 }