Trovit/src/main/java/org/openestate/io/trovit/TrovitUtils.java
public static String printRoomsValue(BigDecimal value) {
        if (value == null)
            throw new IllegalArgumentException("Can't print empty rooms value!");
        if (value.compareTo(BigDecimal.ZERO) < 0)
            throw new IllegalArgumentException("Can't print rooms value '" + value + "' because it is below 0!");
        if (value.compareTo(new BigDecimal("20")) > 0)
            throw new IllegalArgumentException("Can't print rooms value '" + value + "' because it is above 20!");

        value = value.setScale(1, BigDecimal.ROUND_HALF_UP);
        //return DatatypeConverter.printDecimal( value );

        final BigInteger integerPart = value.toBigInteger();
        final BigInteger decimalPart = value.subtract(new BigDecimal(integerPart, 1)).multiply(BigDecimal.TEN).toBigInteger();
        if (decimalPart.compareTo(BigInteger.ZERO) != 0)
            return integerPart.toString() + ".5";

        return DatatypeConverter.printInteger(integerPart);
    }
public static String printRoomsValue(BigDecimal value) {
        if (value == null)
            throw new IllegalArgumentException("Can't print empty rooms value!");
        if (value.compareTo(BigDecimal.ZERO) < 0)
            throw new IllegalArgumentException("Can't print rooms value '" + value + "' because it is below 0!");
        if (value.compareTo(new BigDecimal("20")) > 0)
            throw new IllegalArgumentException("Can't print rooms value '" + value + "' because it is above 20!");

        value = value.setScale(1, BigDecimal.ROUND_HALF_UP);
        //return DatatypeConverter.printDecimal( value );

        final BigInteger integerPart = value.toBigInteger();
        final BigInteger decimalPart = value.subtract(new BigDecimal(integerPart, 1)).multiply(BigDecimal.TEN).toBigInteger();
        if (decimalPart.compareTo(BigInteger.ZERO) != 0)
            return integerPart.toString() + ".5";

        return DatatypeConverter.printInteger(integerPart);
    }
Write a {@link BigDecimal} value into XML output for a room number.

@param value value to write
@return XML string
@throws IllegalArgumentException if a validation error occurred