package com.lessrework.text;

import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;

import java.time.Duration;
import java.time.Instant;

public class CommandLineTester {

    @Parameter(names = {"--value", "-v"}, description = "The value to format.", required = true)
    private long value;

    @Parameter(names = {"--measure", "-m"}, description = "Measures format time")
    private boolean measure;

    public static void main(String[] args) {
        CommandLineTester options = new CommandLineTester();
        JCommander.newBuilder()
            .addObject(options)
            .build()
            .parse(args);

        Instant start = Instant.now();
        NumberToWordFormat format = new NumberToWordFormat();
        StringBuffer buffer = new StringBuffer();
        format.format(options.value, buffer, null);
        System.out.printf("%d,'%s'%n", options.value, buffer.toString());

        Instant end = Instant.now();

        if (options.measure) {
            Duration duration = Duration.between(start, end);
            System.out.printf("Duration %sms%n", duration.toMillis());
        }
    }
}

@@ -101,16 +101,64 @@
 rameter;
+%0Aimport com.beust.jcommander.ParameterException;
 %0A%0Aimport
@@ -348,17 +348,17 @@
 private 
-l
+L
 ong valu
@@ -358,16 +358,23 @@
 ng value
+ = null
 ;%0A%0A    @
@@ -477,16 +477,24 @@
  measure
+ = false
 ;%0A%0A    p
@@ -594,24 +594,42 @@
 ster();%0A
+%0A        try %7B%0A   
         
 JCommand
@@ -620,16 +620,17 @@
         
+ 
 JCommand
@@ -645,16 +645,24 @@
 ilder()%0A
+        
         
@@ -685,16 +685,24 @@
 ptions)%0A
+        
         
@@ -726,16 +726,24 @@
         
+        
 .parse(a
@@ -747,16 +747,110 @@
 e(args);
+%0A        %7D catch (ParameterException e) %7B%0A            e.usage();%0A            return;%0A        %7D
 %0A%0A      
@@ -1046,16 +1046,16 @@
  null);%0A
-
         
@@ -1074,16 +1074,17 @@
 rintf(%22%25
+,
 d,'%25s'%25n

Improving the command line example