List of usage examples for java.lang Long toHexString
public static String toHexString(long i)
From source file:jp.co.ntts.vhut.util.VhutLongConversionUtil.java
/** * ???.//from w w w . ja va 2s. c o m * @param value Long * @param size ??????????? * @return */ public static String toHexString(long value, int size) { String hexValue = Long.toHexString(value); return StringUtils.leftPad(hexValue, size, '0'); }
From source file:Main.java
public static String getCRC32(File file) { CRC32 crc32 = new CRC32(); CheckedInputStream checkedinputstream = null; String crc = null;// w w w .ja v a 2 s.c o m try { checkedinputstream = new CheckedInputStream(new FileInputStream(file), crc32); byte[] buf = new byte[1024]; while (checkedinputstream.read(buf) >= 0) { } crc = Long.toHexString(crc32.getValue()).toUpperCase(); } catch (Exception e) { Log.w(TAG, e); Log.e("WxException", e.getMessage(), e); } finally { if (checkedinputstream != null) { try { checkedinputstream.close(); } catch (IOException e) { } } } return crc; }
From source file:Main.java
public static String generateNonce() { try {//from w w w. j ava2 s . c o m // Create a secure random number generator SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); // Get 1024 random bits byte[] bytes = new byte[1024 / 8]; sr.nextBytes(bytes); // Create two secure number generators with the same seed int seedByteCount = 10; byte[] seed = sr.generateSeed(seedByteCount); sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(seed); SecureRandom sr2 = SecureRandom.getInstance("SHA1PRNG"); sr2.setSeed(seed); String nonce = Long.toHexString(sr2.nextLong()); nonce = nonce.substring(0, 7); return nonce; } catch (NoSuchAlgorithmException e) { } return null; }
From source file:Main.java
static public String zxidToString(long zxid) { return Long.toHexString(zxid); }
From source file:Main.java
private static String getThreadHead(ThreadInfo f) { StringBuffer sb = new StringBuffer(); sb.append('"').append(f.getThreadName()).append('"'); sb.append(" tid=0x" + Long.toHexString(f.getThreadId())); sb.append(" native=" + f.isInNative()); sb.append(" suspended=" + f.isSuspended()); return sb.toString(); }
From source file:org.microg.gms.common.Utils.java
public static String getAndroidIdHex(Context context) { return Long.toHexString(LastCheckinInfo.read(context).androidId); }
From source file:Main.java
static String applyHash(String string) { if (string == null) return null; double[] hashedStrings = new double[HASH_CONSTANTS.length]; for (int i = 0; i < hashedStrings.length; i++) { hashedStrings[i] = applyUserHash(HASH_CONSTANTS[i], string); }/*from ww w . j ava 2 s .c o m*/ double product = 1; for (double hashedString : hashedStrings) { product *= hashedString; } return Long.toHexString(Math.round(Math.abs(product) / 65536d)); }
From source file:Main.java
public static String getGSFID(Context context) { String result;//from ww w . ja v a 2s . c o m final Uri URI = Uri.parse("content://com.google.android.gsf.gservices"); final String ID_KEY = "android_id"; String[] params = { ID_KEY }; Cursor c = context.getContentResolver().query(URI, null, null, params, null); if (c == null || !c.moveToFirst() || c.getColumnCount() < 2) { return null; } else { result = Long.toHexString(Long.parseLong(c.getString(1))); } c.close(); return result; }
From source file:com.trendrr.oss.networking.strest.StrestUtil.java
public static String generateTxnId() { return "str" + Long.toHexString(txn.incrementAndGet()) + "st"; }
From source file:Main.java
public static String toString(byte[] array) { String s = ""; if (array == null) return s; for (byte b : array) { String str = Long.toHexString(b); String trimmed = (str.length() > 2) ? str.substring(str.length() - 2, str.length()) : str; if (trimmed.length() == 1) trimmed = "0" + trimmed; s += trimmed + " "; }/*from w ww.java2 s. c om*/ return s; }