Java Char to Int twoChars2Int(char ch, char cl)

Here you can find the source of twoChars2Int(char ch, char cl)

Description

Converts two characters two an int number

License

LGPL

Parameter

Parameter Description
chars a parameter

Declaration

public static int twoChars2Int(char ch, char cl) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

public class Main {
    /** //from  ww  w.j a v  a 2 s. co  m
     * Converts two characters two an int number
     * 
     * @param chars
     * @return
     */
    public static int twoChars2Int(char ch, char cl) {
        int l = (ch << 16) + cl;
        return l;
    }

    public static int twoChars2Int(char[] cs) {
        if (cs.length != 2) {
            throw new RuntimeException(
                    "Called twoChars2Int with an array that does not have 2 elements but " + cs.length);
        }
        return twoChars2Int(cs[0], cs[1]);
    }
}

Related

  1. charToInt(char c)
  2. charToInt(char c)
  3. charToInt(char c)
  4. charToInt(char c)
  5. charToInt(char c)