Decimal To Any Base Algorithm

The manner of denoting numbers in the decimal system is often referred to as decimal notation."Decimal" may also refer specifically to the digits after the decimal separator, such as in" 3.14 is the estimation of π to two decimals". The Egyptian hieratic numerals, the Greek alphabet numerals, the Hebrew alphabet numerals, the Roman numerals, the Chinese numerals and early Indian Brahmi numerals are all non-positional decimal systems, and need large numbers of symbols. Egyptian hieroglyphs, in evidence since around 3000 BCE, used a purely decimal system, as make the Cretan hieroglyphs (c.   1625−1500 BCE) of the Minoans whose numerals are closely based on the Egyptian model. Some non-mathematical ancient texts like the Vedas, dating back to 1900–1700 BCE make purpose of decimals and mathematical decimal fractions.
package Conversions;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;

/**
 *
 * @author Varun Upadhyay (https://github.com/varunu28)
 *
 */

// Driver Program
public class DecimalToAnyBase {
    public static void main (String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the decimal input below: ");
        int decInput = Integer.parseInt(br.readLine());
        System.out.println();

        System.out.println("Enter the base below: ");
        int base =  Integer.parseInt(br.readLine());
        System.out.println();

        System.out.println("Decimal Input" + " is: " + decInput);
        System.out.println("Value of " + decInput + " in base " + base + " is: " + convertToAnyBase(decInput, base));

        br.close();
    }

    /**
     * This method produces a String value of any given input decimal in any base
     * @param inp Decimal of which we need the value in base in String format
     * @return string format of the converted value in the given base
     */

    public static String convertToAnyBase(int inp, int base) {
        ArrayList<Character> charArr = new ArrayList<>();

        while (inp > 0) {
            charArr.add(reVal(inp%base));
            inp /= base;
        }

        StringBuilder str = new StringBuilder(charArr.size());

        for(Character ch: charArr)
        {
            str.append(ch);
        }

        return str.reverse().toString();
    }

    /**
     * This method produces character value of the input integer and returns it
     * @param num integer of which we need the character value of
     * @return character value of input integer
     */

    public static char reVal(int num) {
        if (num >= 0 && num <= 9)
            return (char)(num + '0');
        else
            return (char)(num - 10 + 'A');
    }
}

LANGUAGE:

DARK MODE: