title: the error when i change a number in decimal base to another base
body: <p>I am writing a java code to <strong>Change a number from decimal base to another base</strong>.
  But I don't know why the program runs wrong. I think the error comes from function Prin_as. Can anyone tell me why ?</p>
  
  <p>Below is my code,</p>
  
  <pre><code>import java.util.Scanner;
  
  public class bai2chuyendoi {
  
      public static void main(String[] args) {
          int a, b;
  
          System.out.println("Number in decimal base:");
          a = Enter();
          System.out.println("Other base :");
          b = Enter();
          Change_base (a, b);
      }
  
      public static int Enter() {
          int n = 0;
          boolean check = false;
          while (!check) {
              Scanner sc = new Scanner(System.in);
              try {
                  n = sc.nextInt();
                  check = true;
              } catch (Exception e) {
                  System.out.println("Enter again:");
                  sc.nextLine();
              }
          }
          return n;
      }
  
      public static void Change_base(int a, int b) {
          int i = 0;
          int[] c = new int[8];
          while (a != 0) {
              c[i] = a % b;
              a = a / b;
              i++;
  
          }
          while (i &gt;= 0) {
              --i;
              if (c[i] &lt; 10) {
                  System.out.print(c[i]);
              } else {
                 System.out.print((char) (c[i] + 55));
              }
  
          }
      }
  }
  </code></pre>