title: Any ideas to make my code efficient for looping 10 000 000 000 times
body: <p>I've made a simple code to count the occurrences of the digit '14' from a given number. I've successfully print out the counter if the given number is 10 000 000 and it took less than 1 second. When i increase the number to 
  10 000 000 000 it took 459 seconds. Any ideas on how to make it runs faster?</p>
  
  <pre><code>long startTime = System.nanoTime();
          long counter = 0L;
          for (long i = 14; i &lt;= 10000000000L; i++)
          {
              String s = Long.toString(i);//i.ToString();
              if (s.contains("14"))
              {
                  counter += 1;
              }
  
          }
          long endTime   = System.nanoTime();
          long totalTime = endTime - startTime;
          long convert = TimeUnit.SECONDS.convert(totalTime, TimeUnit.NANOSECONDS);
  
          System.out.println(convert + " seconds");
          System.out.println(counter);
  </code></pre>
  
  <p>time taken : 459 seconds <br>
  number of 14 appears : 872348501</p>