@@ -171,10 +171,7 @@ private String formatByteVector(String str, String flags, int width,
171
171
* @return The formatted element
172
172
*/
173
173
private String formatVectorValue (int byteValue , String flags , int width , int precision ,
174
- char conversionChar ) {
175
- // System.err.println("DEBUG: formatVectorValue called with byteValue=" + byteValue +
176
- // ", flags='" + flags + "', width=" + width + ", precision=" + precision);
177
-
174
+ char conversionChar ) {
178
175
String formatted = switch (conversionChar ) {
179
176
case 'd' , 'i' -> formatVectorDecimal (byteValue , flags );
180
177
case 'o' -> formatVectorOctal (byteValue , flags );
@@ -184,16 +181,17 @@ private String formatVectorValue(int byteValue, String flags, int width, int pre
184
181
default -> String .valueOf (byteValue );
185
182
};
186
183
187
- // System.err.println("DEBUG: After formatting: '" + formatted + "'");
188
-
189
184
// Apply precision first
190
185
formatted = SprintfPaddingHelper .applyVectorPrecision (formatted , precision , flags );
191
- // System.err.println("DEBUG: After precision: '" + formatted + "'");
186
+
187
+ // For vector formats, if precision is specified, ignore the '0' flag
188
+ String widthFlags = flags ;
189
+ if (precision >= 0 && flags .contains ("0" )) {
190
+ widthFlags = flags .replace ("0" , "" );
191
+ }
192
192
193
193
// Then apply width to the individual element
194
- String result = SprintfPaddingHelper .applyWidth (formatted , width , flags );
195
- // System.err.println("DEBUG: After width: '" + formatted + "' -> '" + result + "'");
196
- return result ;
194
+ return SprintfPaddingHelper .applyWidth (formatted , width , widthFlags );
197
195
}
198
196
199
197
/**
0 commit comments