// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class MaxLen {
    public static void main(String[] args) {
        String s = "1234567890";
        String s2 = String.format("|%.5s|", s);
        System.out.println(s2);
        String s3 = String.format("|%.50s|", s);
        System.out.println(s3);
    }
}
