Java Hash Calculate hashToName(long l)

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

Description

Converts a long hash to a string.

License

Open Source License

Parameter

Parameter Description
l the long to convert.

Return

the converted string.

Declaration

public static String hashToName(long l) 

Method Source Code

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

public class Main {
    /** A table of valid characters. */
    public 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', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '-', '+', '=', ':', ';', '.', '>', '<', ',',
            '"', '[', ']', '|', '?', '/', '`' };

    /**//w  w w.j  a v  a2 s . co m
     * Converts a long hash to a string.
     * 
     * @param l
     *            the long to convert.
     * @return the converted string.
     */
    public static String hashToName(long l) {
        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. hashPoint(int hashlength, double fraction)
  2. hashSetSize(final int nrOfElements)
  3. hashThem(Object one, Object two)
  4. hashToFloat(int x, int y, long seed)
  5. hashToLong(final byte[] hash)
  6. hashV(Object... a)
  7. hashValueFor(final boolean b)
  8. toHash(Long number)
  9. toHash(Object obj)