Здесь я рассмотрел кучу вопросов о моей проблеме, и даже о Java, но я не смог ее выяснить. Вот мой код
System.out.printf(
"%-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s\n",
"Record #",
"Inventory",
"Size", "Color", "Cost", "Markup", "Sale Price", "QTY", "SKU #");
for (int x = 0; x < StoreInventory.inventory.length; ++x) {
System.out.printf(
"%-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s %-20s\n", x + 1,
StoreInventory.inventory[x][0],
StoreInventory.inventory[x][1],
StoreInventory.inventory[x][2],
StoreInventory.buyPrice[x],
StoreInventory.markUp[x],
StoreInventory.storeSalePrice[x],
StoreInventory.quantity[x],
StoreInventory.skuNumber[x]);
}
Вывод:
Record # Inventory Size Color Cost Markup Sale Price QTY SKU #
1 SHORTS XL BLACK 5.0 10.0 50.0 10 SL-1234AE
Все поля являются пользовательскими.
Что мне нужно изменить, чтобы выровнять вывод независимо от размера ввода?