how to put a fixed number of 0's infront of a long in java?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/473282/left-padding-integers-with-zeros-in-java">Left padding integers with zeros in Java</a>  </p>
</blockquote>



<p>I have a problem. i am working on a android app</p>

<p>I have a long timestap and a string that i need to combine. The catch is that if the long is less than 8 digits, then i need to display 0's to make it look good.</p>

<p>Example</p>

<p>long time = 311;</p>

<p>how can i fill it out so it will be </p>

<p>00000311</p>

<p>long time2 = 3111</p>

<p>00003111</p>

<p>I hope any of you an help me with it since i been trying to find a solution for it for over an hour now..</p>

<p>Rasmus</p>
