List of usage examples for java.lang String hashCode
public int hashCode()
From source file:Main.java
public static String toRegularHashCode(String string) { final String hexHashCode = Integer.toHexString(string.hashCode()); final StringBuilder stringBuilder = new StringBuilder(hexHashCode); while (stringBuilder.length() < 8) { stringBuilder.insert(0, '0'); }/* ww w .j a v a 2 s. co m*/ return stringBuilder.toString(); }
From source file:Main.java
public static UUID getUUID(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String uniqueId = tm.getDeviceId(); UUID deviceUuid = new UUID(uniqueId.hashCode(), 64); return deviceUuid; }
From source file:Main.java
public static String computeWeakHash(String string) { return String.format(Locale.US, "%08x%08x", string.hashCode(), string.length()); }
From source file:Main.java
private static String getHashCode(String url) { if (!TextUtils.isEmpty(url)) { return String.valueOf(url.hashCode()); }//w ww. ja v a2 s .co m return null; }
From source file:Main.java
public static File getPDFFileLink(Context context, String fileLink) { return new File(new File(context.getExternalFilesDir(null), "pdf"), fileLink.hashCode() + ".pdf"); }
From source file:Main.java
public static String getCacheFileName(String url) { if (url == null) return null; return CACHE_DIRECTORY + url.hashCode() + ".jpg"; }
From source file:Main.java
private static String getSubdirectory(String resourceId) { return TextUtils.isEmpty(resourceId) ? resourceId : String.valueOf(Math.abs(resourceId.hashCode() % 100)); }
From source file:jetbrick.tools.chm.reader.AnchorNameManager.java
public static String getNewAnchorName(String anchor) { return "HH_" + Math.abs(anchor.hashCode()); }
From source file:Main.java
/** * Calculation md5 hash of string/*from w ww . j ava 2 s . c om*/ * * @param s - string for hash calculation * @return md5 hash of input string */ public static String MD5Hash(String s) { int sHash = s.hashCode(); String result = md5Cache.get(sHash); if (result != null) return result; try { if (MD5 == null) MD5 = MessageDigest.getInstance("MD5"); MessageDigest alg = (MessageDigest) MD5.clone(); alg.update(s.getBytes()); StringBuffer hexString = new StringBuffer(32); for (byte b : alg.digest()) hexString.append(intToHexChars(0xFF & b)); result = hexString.toString(); } catch (Exception e) { } if (result == null) result = String.valueOf(s.hashCode()); md5Cache.put(sHash, result); return result; }
From source file:Main.java
public static String getCachePathByUrl(String url) { if (TextUtils.isEmpty(url)) { return null; }//from ww w. ja v a 2 s .co m return uiBufferPath + url.hashCode(); }