Java Long to String longToString(long l)

Here you can find the source of longToString(long l)

Description

long To String

License

Open Source License

Declaration

public static String longToString(long l) 

Method Source Code

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

public class Main {
    private static final char[] VALID_CHARS = { '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
            'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6',
            '7', '8', '9' };

    public static String longToString(long l) {
        if (l <= 0L || l >= 0x5b5b57f8a98a5dd1L) {
            return null;
        }//from   ww w.  j av a  2s . co  m
        if (l % 37L == 0L) {
            return null;
        }
        int i = 0;
        char ac[] = new char[12];
        while (l != 0L) {
            long l1 = l;
            l /= 37L;
            ac[11 - i++] = VALID_CHARS[(int) (l1 - l * 37L)];
        }
        return new String(ac, 12 - i, i);
    }
}

Related

  1. long2String(long x)
  2. long2StringForLen(long num, String str)
  3. long2Word(long val)
  4. LongToStr(long nValue)
  5. longToString(final long value)
  6. longToString(long l)
  7. LongToString(Long l, int length)
  8. longToString(long li)
  9. longToString(long longV)