code: public static void main(final String[] args) {
  
          List<InstanceStateChange> iscs = stopInstances(Arrays.asList(args));
  
          if (null != iscs && iscs.size() > 0) {
              System.out.println("Instance state changes: ");
              for (InstanceStateChange isc : iscs) {
                  System.out.println(isc.getInstanceId() + ": " + isc.getPreviousState().getName() + " -> "
                          + isc.getCurrentState().getName());
              }
          } else {
              System.out.println("Nothing happened! Make sure you input the right instance IDs.");
              System.out.println("usage: java StopInstancesExample <instanceID-1> [instanceID-2] [instanceID-3] ...");
          }
  
      }
docs: Main method for command line use.
  
  @param args
  parameters from command line - IDs of the instances to stop