Java Long to String LongToString(Long l, int length)

Here you can find the source of LongToString(Long l, int length)

Description

Long To String

License

Open Source License

Declaration

public static String LongToString(Long l, int length) 

Method Source Code

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

public class Main {
    public static String LongToString(Long l, int length) {
        char[] output = new char[length];
        while (length-- > 0) {
            output[length] = int2Char((int) (l & 3));
            l >>= 2;/*from   w w w. j  a  v a 2 s.  co m*/
        }
        return new String(output);
    }

    /** converts from 2-bit representation to character representation
     */
    public static char int2Char(int i) {
        switch (i) {
        case 0:
            return 'A';
        case 1:
            return 'T';
        case 2:
            return 'G';
        case 3:
            return 'C';
        }
        return 'n';
    }
}

Related

  1. long2Word(long val)
  2. LongToStr(long nValue)
  3. longToString(final long value)
  4. longToString(long l)
  5. longToString(long l)
  6. longToString(long li)
  7. longToString(long longV)
  8. longToString(long longValue)
  9. longToString(long longValue, boolean noCase)