SHARE
TWEET

Untitled

a guest Jun 26th, 2012 127 Never
  1. public class App {
  2.  
  3.     public static void main(String[] args) throws Exception {
  4.  
  5.         System.out.println("Java Version: " + System.getProperty("java.vm.version"));
  6.  
  7.         for (int i = 0; true; i++) {
  8.             for (int j = 0; j < 100; j++) {
  9.                 // short delay (required)
  10.             }
  11.  
  12.             String s = "hello";
  13.             s = new StringBuilder(String.valueOf(s)).append(s).toString();
  14.             s = new StringBuilder(String.valueOf(s)).append(s).toString();
  15.  
  16.             if (s.length() != 20) {
  17.                 System.out.println("Failed at iteration: " + i);
  18.                 System.out.println("Length mismatch: " + s.length() + " <> " + 16);
  19.                 System.out.println("Expected:   \"hellohellohellohello\"");
  20.                 System.out.println("Actual:   \"" + s + "\"");
  21.                 System.exit(0);
  22.             }
  23.         }
  24.     }
  25. }
RAW Paste Data
Top