private static void handleRightAdjust(TerminalSendAction terminalSendAction) { List<TerminalField> fields = terminalSendAction.getFields(); for (TerminalField terminalField : fields) { if (terminalField.getRightAdjust() != RightAdjust.NONE) { if (terminalField.getLength() > terminalField.getValue().length()) { String fillerChar = terminalField.getRightAdjust() == RightAdjust.ZERO_FILL ? "0" : " "; String newValue = StringUtils.leftPad(terminalField.getValue(), terminalField.getLength(), fillerChar); terminalField.setValue(newValue); } } } }