MarketDisplayBaseImpl implements MarketDisplay { @Override public String priceFractionText(PriceValue price, Fraction frac) { if (price == null) { price = ValueConst.NULL_PRICE; } if(frac == null || frac.isNull()) { frac = Fraction.NULL; } long value = frac.priceFraction(price.mantissa(), price.exponent()); final char[] array = new char[frac.places()]; for(int k = frac.places() - 1; k >= 0; k--) { final char alpha = (char) (value % 10 + '0'); value /= 10; array[k] = alpha; } return new String(array); }  @Override String timeYearFull(TimeValue time); @Override String timeYearShort(TimeValue time); @Override String timeMonthFull(TimeValue time); @Override String timeMonthShort(TimeValue time); @Override String timeMonthCode(TimeValue time); @Override String priceFractionText(PriceValue price, Fraction frac); @Override String priceText(PriceValue price, Fraction frac); @Override String priceText(PriceValue price, long base, long exponent); @Override String priceText(long mantissa, int exponent, long base, long baseExp); @Override String sizeText(SizeValue size); @Override String sizeText(long size); @Override String timeTextISO(TimeValue value); @Override String timeTextShort(TimeValue value); @Override String dateTimeText(TimeValue value); @Override String dateTextShort(TimeValue value); @Override String timeTextShort(TimeValue value, DateTimeZone zone);  }
@Test public void testPriceFractionString() { Fraction frac; PriceValue price; long fraction; String string; frac = BIN_N01; price = newPrice(123500, -3); fraction = frac.priceFraction(price.mantissa(), price.exponent()); assertEquals(1, fraction); string = display.priceFractionText(price, frac); assertEquals("1", string); frac = BIN_N02; price = newPrice(123500, -3); fraction = frac.priceFraction(price.mantissa(), price.exponent()); assertEquals(2, fraction); string = display.priceFractionText(price, frac); assertEquals("2", string); frac = BIN_N03; price = newPrice(123500, -3); fraction = frac.priceFraction(price.mantissa(), price.exponent()); assertEquals(4, fraction); string = display.priceFractionText(price, frac); assertEquals("4", string); frac = BIN_N04; price = newPrice(123500, -3); fraction = frac.priceFraction(price.mantissa(), price.exponent()); assertEquals(8, fraction); string = display.priceFractionText(price, frac); assertEquals("08", string); frac = BIN_N07; price = newPrice(123500, -3); fraction = frac.priceFraction(price.mantissa(), price.exponent()); assertEquals(64, fraction); string = display.priceFractionText(price, frac); assertEquals("064", string); }