Java Integer to Char intToChar(int i)

Here you can find the source of intToChar(int i)

Description

Converts number to character.

License

Academic Free License

Parameter

Parameter Description
i a parameter

Declaration

public static char intToChar(int i) 

Method Source Code

//package com.java2s;
//License from project: Academic Free License 

public class Main {
    public static final char PAD_CHAR = '=';

    /**/*w w w  .  j a  v a 2s . co m*/
     * Converts number to character.
     * 
     * @param i
     * @return
     */
    public static char intToChar(int i) {
        char c = PAD_CHAR;

        if (i >= 0) {
            if (i < 26) {
                c = (char) ('A' + i);
            } else if (i < 52) {
                c = (char) ('a' + i - 26);
            } else if (i < 62) {
                c = (char) ('0' + i - 52);
            } else if (i == 62) {
                c = '+';
            } else if (i == 63) {
                c = '/';
            }
        }
        return c;
    }
}

Related

  1. intToChar(int i)
  2. intToChar(int i)
  3. intToCharacter(int i)
  4. intToChars(int value, char[] chars, int offset)