Java Binary Encode toBinFromOctChar(final char oct)

Here you can find the source of toBinFromOctChar(final char oct)

Description

to Bin From Oct Char

License

Open Source License

Declaration

public static String toBinFromOctChar(final char oct) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String toBinFromOctChar(final char oct) {
        switch (oct) {
        case '0':
            return ("000");
        case '1':
            return ("001");
        case '2':
            return ("010");
        case '3':
            return ("011");
        case '4':
            return ("100");
        case '5':
            return ("101");
        case '6':
            return ("110");
        case '7':
            return ("111");
        default:/*from ww  w.j  a  va2  s.co  m*/
            throw new IllegalArgumentException(
                    "The input character \'" + oct + "\'is not a valid octal character.");
        }
    }
}

Related

  1. toBinaryText(StringBuffer buf)
  2. toBinFromByte(final byte b)
  3. toBinFromHex(final String hexSymbols)
  4. toBinFromHexChar(final char hex)
  5. toBinFromOct(final String octSymbols)
  6. toBinString(byte b)
  7. toBinString(byte value)
  8. toBinString(byte[] byteArray)
  9. toBinString(int val, int minLength)