code: public static String encodeRealNumberRange(float number, int maxDigitsLeft, int maxDigitsRight, int offsetValue) {
          int shiftMultiplier = (int) Math.pow(10, maxDigitsRight);
          long shiftedNumber = (long) Math.round((double) number * shiftMultiplier);
          long shiftedOffset = offsetValue * shiftMultiplier;
          long offsetNumber = shiftedNumber + shiftedOffset;
  
          if (offsetNumber < 0) {
              throw new IllegalArgumentException("OffsetNumber[" + offsetNumber + "] is negative - Number[" + number
                      + "], maxDigitsLeft[" + maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue["
                      + offsetValue + "]");
          }
  
          String longString = Long.toString(offsetNumber);
          int numBeforeDecimal = longString.length();
          int numZeroes = maxDigitsLeft + maxDigitsRight - numBeforeDecimal;
  
          if (numZeroes < 0) {
              throw new IllegalArgumentException("Number[" + number + "] has too many digits - maxDigitsLeft["
                      + maxDigitsLeft + "], maxDigitsRight[" + maxDigitsRight + "], offsetValue[" + offsetValue + "]");
          }
  
          StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length());
          for (int i = 0; i < numZeroes; i++) {
              strBuffer.insert(i, '0');
          }
          strBuffer.append(longString);
          return strBuffer.toString();
      }
docs: Encodes real float value into a string by offsetting and zero-padding number up to the
  specified number of digits. Use this encoding method if the data range set includes both
  positive and negative values.
  
  @param number
  float to be encoded
  @param maxDigitsLeft
  maximum number of digits left of the decimal point in the largest absolute value
  in the data set
  @param maxDigitsRight
  maximum number of digits right of the decimal point in the largest absolute value
  in the data set, i.e. precision
  @param offsetValue
  offset value, has to be greater than absolute value of any negative number in the
  data set.
  @return string representation of the integer