title: java conversion of arabic numbers to roman numerals
body: <p>Im writing this program for a java class im having. The point of this program is to convert an Arabic number input, into a Roman numeral.</p>
  
  <p>here is my code:</p>
  
  <pre><code>import java.util.Scanner;
  
  public class RomanDigit{
  public static void main(String arg []){
      System.out.println("Please enter a number to be converted to roman numerals: ");
      Scanner scan = new Scanner (System.in);
      int number = scan.nextInt();
      String romanDigit = "";
      if (number &lt; 0 || number &gt; 3999) {
          System.out.println( "This number cannot be converted");
      }
      else
      {
          System.out.println("The number you input, converted into roman numerals is: " + romanDigit);
          System.out.println(convert(number));
      }
  }
  
  
  
      public static String romanDigit(int n, String one, String five, String ten){
  
      if(n &gt;= 1)
      {
          if(n == 1)
          {
              return one;
          }
          else if (n == 2)
          {
              return one + one;
          }
          else if (n == 3)
          {
              return one + one + one;
          }
          else if (n==4)
          {
              return one + five;
          }
          else if (n == 5)
          {
              return five;
          }
          else if (n == 6)
          {
              return five + one;
          }
          else if (n == 7)
          {
              return five + one + one;
          }
          else if (n == 8)
          {
              return five + one + one + one;
          }
          else if (n == 9)
          {
              return one + ten;
          }
  
      }
      return "";
  }
  
  public static String convert(int number){
  
      String romanOnes = romanDigit( number%10, "I", "V", "X");
      number /=10;
      String romanTens = romanDigit( number%10, "X", "L", "C");
      number /=10;
      String romanHundreds = romanDigit(number%10, "C", "D", "M");
      number /=10;
      String romanThousands = romanDigit(number%10, "M", "", "");
  
      String result = romanThousands + romanHundreds + romanTens + romanOnes;
      return result;
  
  }
  }
  </code></pre>
  
  <p>I edited the code now for the given suggestions. I noticed I was missing the number /= 10; statement in the end. For some reason i deleted it before and forgot to put it back. Seems to be working fine now. The reason it was not working besides the number/=10 statement, was that I had the If statement in the wrong place.</p>