Java Long to longTo36Str(String str)

Here you can find the source of longTo36Str(String str)

Description

long To Str

License

Open Source License

Declaration

public static String longTo36Str(String str) 

Method Source Code

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

public class Main {
    public static String longTo36Str(String str) {
        StringBuilder sb = new StringBuilder(10);
        int size = str.length() / 2 * 2;
        int mod = str.length() % 2;
        if (size > 0) {
            for (int i = 0; i < size; i = i + 2) {
                int a = Integer.valueOf(str.substring(i, i + 2));
                sb.append(Integer.toString(a, 36));
            }// w  w  w  .j  a va  2  s.c  o m
        }
        if (mod > 0) {
            sb.append(str.substring(str.length() - 1));
        }
        return sb.toString();
    }

    public static String longTo36Str(long num) {
        String str = Long.toString(num);
        return longTo36Str(str);
    }
}

Related

  1. Long2H(final long l)
  2. long2leb(final long x, final byte[] buf, final int offset)
  3. long2longArr(long val, long[] res)
  4. long2MacAddress(long l)
  5. long2minLeb(final long x)
  6. longTo4ByteArray(byte[] bytes, int offset, long value)
  7. longTo4LengthBytes(long num)
  8. LongToAscii(long number, byte[] buf, int offset, int length)
  9. longToBaseCode(char[] target, int targetOffset, long value, int base, int lengthLimit, boolean fillZeros, boolean upperCase)