/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.wikibooks.hadoop.yarn.examples;

public class HelloYarn {
  private static final long MEGABYTE = 1024L * 1024L;

  public HelloYarn() {
    System.out.println("HelloYarn!");
  }

  public static long bytesToMegabytes(long bytes) {
    return bytes / MEGABYTE;
  }

  public void printMemoryStats() {
    long freeMemory = bytesToMegabytes(Runtime.getRuntime().freeMemory());
    long totalMemory = bytesToMegabytes(Runtime.getRuntime().totalMemory());
    long maxMemory = bytesToMegabytes(Runtime.getRuntime().maxMemory());

    System.out.println("The amount of free memory in the Java Virtual Machine: " + freeMemory);
    System.out.println("The total amount of memory in the Java virtual machine: " + totalMemory);
    System.out.println("The maximum amount of memory that the Java virtual machine: " + maxMemory);
  }

  public static void main(String[] args) {
    HelloYarn helloYarn = new HelloYarn();
    helloYarn.printMemoryStats();
  }



//  private void run(String[] args) {
//    System.out.println("Classpath in the environment: " + System.getenv("CLASSPATH"));
//    System.out.println("Classpath in the local resource:");
//    ClassLoader cl = ClassLoader.getSystemClassLoader();
//    if (cl instanceof URLClassLoader) {
//      for (URL url : ((URLClassLoader)cl).getURLs()) {
//        System.out.println(url);
//      }
//    }
//  }
//
//  public static void main(String[] args) {
//    System.out.println("Running HelloYarn");
//    new HelloYarn().run(args);
//    System.out.println("Finished HelloYarn");
//  }

}

@@ -1766,598 +1766,6 @@
   %7D%0A
-%0A%0A%0A//  private void run(String%5B%5D args) %7B%0A//    System.out.println(%22Classpath in the environment: %22 + System.getenv(%22CLASSPATH%22));%0A//    System.out.println(%22Classpath in the local resource:%22);%0A//    ClassLoader cl = ClassLoader.getSystemClassLoader();%0A//    if (cl instanceof URLClassLoader) %7B%0A//      for (URL url : ((URLClassLoader)cl).getURLs()) %7B%0A//        System.out.println(url);%0A//      %7D%0A//    %7D%0A//  %7D%0A//%0A//  public static void main(String%5B%5D args) %7B%0A//    System.out.println(%22Running HelloYarn%22);%0A//    new HelloYarn().run(args);%0A//    System.out.println(%22Finished HelloYarn%22);%0A//  %7D%0A%0A
 %7D%0A

remove unnecessary codes