String (boolean includeProductCode, boolean withSnapshotMarker) { StringBuilder builder = new StringBuilder(); if (includeProductCode && !myProductCode.isEmpty()) { builder.append(myProductCode).append('-'); } for (int each : myComponents) { if (each != SNAPSHOT_VALUE) { builder.append(each); } else if (withSnapshotMarker) { builder.append(SNAPSHOT); } builder.append('.'); } if (builder.charAt(builder.length() - 1) == '.') { builder.setLength(builder.length() - 1); } return builder.toString(); }