List of usage examples for java.util UUID toString
public String toString()
From source file:Main.java
public static byte[] toArray(UUID uuid) { String data = uuid.toString().replace("-", ""); int length = data.length() / 2; byte[] result = new byte[length]; for (int i = 0; i < length; i++) { int value = Integer.valueOf(data.substring(2 * i, 2 * i + 2), 16); result[i] = (byte) value; }/*w w w. jav a2s. co m*/ return result; }
From source file:Main.java
private static String saveCroppedImage(Bitmap bmp) { File file = new File("/sdcard/myFolder"); UUID uuid = UUID.randomUUID(); String uid = uuid.toString(); if (!file.exists()) file.mkdir();//www. jav a 2 s. com String name = "/sdcard/" + uid + ".jpg"; file = new File(name.trim()); String fileName = file.getName(); String mName = fileName.substring(0, fileName.lastIndexOf(".")); String sName = fileName.substring(fileName.lastIndexOf(".")); // /sdcard/myFolder/temp_cropped.jpg String newFilePath = "/sdcard/myFolder" + "/" + mName + "_cropped" + sName; file = new File(newFilePath); try { file.createNewFile(); FileOutputStream fos = new FileOutputStream(file); bmp.compress(Bitmap.CompressFormat.JPEG, 50, fos); fos.flush(); fos.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return newFilePath; }
From source file:nu.yona.server.batch.quartz.jobs.PinResetConfirmationCodeSenderQuartzJob.java
public static Map<String, Object> buildParameterMap(UUID userId, String localeString) { return ImmutableMap.of(USER_ID_KEY, userId.toString(), LOCALE_STRING_KEY, localeString); }
From source file:br.net.fabiozumbi12.RedProtect.hooks.MojangUUIDs.java
public static String getName(UUID uuid) { return getName(uuid.toString()); }
From source file:com.hengyi.japp.tools.UuidUtils.java
public static String decodeBase64Uuid(String compressedUuid) { byte[] byUuid = Base64.decodeBase64(compressedUuid); ByteBuffer bb = ByteBuffer.wrap(byUuid); UUID uuid = new UUID(bb.getLong(), bb.getLong()); return uuid.toString(); }
From source file:com.hengyi.japp.tools.UuidUtils.java
public static String decodeBase58Uuid(String base58uuid) { byte[] byUuid = Base58.decode(base58uuid); ByteBuffer bb = ByteBuffer.wrap(byUuid); UUID uuid = new UUID(bb.getLong(), bb.getLong()); return uuid.toString(); }
From source file:com.quartz.monitor.util.Tools.java
public static String generateUUID() { UUID id = UUID.randomUUID(); return id.toString(); }
From source file:com.sqewd.os.maracache.mdfs.VersionUtils.java
public static long next(long current) throws NoSuchAlgorithmException, UnsupportedEncodingException { while (true) { UUID uuid = UUID.randomUUID(); char[] buff = uuid.toString().toCharArray(); long v = System.currentTimeMillis(); for (int ii = 0; ii < buff.length; ii++) { v += (buff[ii] * (ii + iphash)); }//ww w .ja v a 2 s.com if (v != current) { return v; } } }
From source file:com.mobileman.kuravis.core.util.security.SecurityUtils.java
/** * @param length/*from ww w .j a v a 2 s . com*/ * @return random string */ public static String getRandomString(int length) { String result = ""; UUID uuid = UUID.randomUUID(); result = uuid.toString().substring(0, length); return result; }
From source file:Main.java
public static String getDeviceKey(Context ctx) { final TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); final String tmDevice, tmSerial, androidId; tmDevice = "" + tm.getDeviceId(); tmSerial = "" + tm.getSimSerialNumber(); androidId = "" + android.provider.Settings.Secure.getString(ctx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); UUID deviceUuid = new UUID(androidId.hashCode(), ((long) tmDevice.hashCode() << 32) | tmSerial.hashCode()); return deviceUuid.toString(); }