title: How to convert VB code to Java
body: <p>I'm trying to convert these VB functions to Java. this is what I have done so far. I'm having problem with getting the <code>nRandom</code> it always returns the value of <code>nLow</code> my suspect for this is the <code>R</code> as I've print <code>R</code> it always gives the answer <code>0.0</code></p>
  
  <p>Question: what is wrong with my Java code? </p>
  
  <p><strong>VB CODE</strong></p>
  
  <pre><code>Function GetRandom(ByVal nLow As String, ByVal nHigh As String) As String
  
              Static boolStarted As Boolean
              Dim nRandom As String
              If Not boolStarted Then
                  Randomize(Second(Now) / 100)
                  Rnd()
              End If
              nRandom = Int((nHigh - nLow + 1) * Rnd() + nLow)
              GetRandom = nRandom
          End Function
  </code></pre>
  
  <p><strong>JAVA CODE</strong></p>
  
  <pre><code>private String GetRandom(String nLow, String nHigh)
      {
          boolean boolStarted=false;
          String nRandom;
          Date date=new Date();
          double R=0;
          if(boolStarted==false)
          {
              Random rnd=new Random();
              //R=rnd.nextInt(Math.round(date.getSeconds()/100));
              //R=rnd.nextDouble();
              R=Math.round(Integer.valueOf(date.getSeconds())/100);
          }
  
          System.out.println("Random: "+R);
          System.out.println("SEC: "+date.getSeconds());
          nRandom=String.valueOf((Integer.valueOf(nHigh)-Integer.valueOf(nLow)+1)*R+Integer.valueOf(nLow));
          return nRandom;
      }
  </code></pre>