format inverted-index java code