private static String getFormat ( Map < ? , ? > map , int keyPrecision , int valuePrecision ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( ' ' ) ; int mappings = map . keySet ( ) . size ( ) ; int c = 0 ; for ( Object key : map . keySet ( ) ) { c ++ ; builder . append ( FormatUtils . getIndexedFormat ( c , FormatUtils . getFormat ( key , keyPrecision ) . substring ( 1 ) ) ) ; builder . append ( VALUE_MAPPING ) ; builder . append ( FormatUtils . getIndexedFormat ( mappings + c , FormatUtils . getFormat ( map . get ( key ) , valuePrecision ) . substring ( 1 ) ) ) ; if ( c < mappings ) builder . append ( VALUE_SEPARATION ) ; } builder . append ( ' ' ) ; return builder . toString ( ) ; }
Returns a format - String that can be used to generate a String representation of a map using the String . format method .