List of usage examples for java.lang Long valueOf
@HotSpotIntrinsicCandidate public static Long valueOf(long l)
From source file:Main.java
public static String getStrTime_md(String cc_time) { String re_StrTime = null;/* w ww . j a va 2 s. c o m*/ SimpleDateFormat sdf = new SimpleDateFormat("MM-dd"); long lcc_time = Long.valueOf(cc_time); re_StrTime = sdf.format(new Date(lcc_time * 1000L)); return re_StrTime; }
From source file:Main.java
public static Long getLongAttribute(NamedNodeMap namedNodeMap, String name) { String value = getAttribute(namedNodeMap, name); if (value == null) { return null; } else {// w w w . j a va2 s .c o m return Long.valueOf(value); } }
From source file:Main.java
public static String getStrTime_ymd(String cc_time) { String re_StrTime = null;/*from w w w . j ava2s .co m*/ SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd"); long lcc_time = Long.valueOf(cc_time); re_StrTime = sdf.format(new Date(lcc_time * 1000L)); return re_StrTime; }
From source file:Main.java
public static boolean isMediaInDateRange(String mediaTimeStamp) { if (!TextUtils.isEmpty(mediaTimeStamp)) { Date currentDate = new Date(); long mediaDateLong = Long.valueOf(mediaTimeStamp) * 1000L; long diff = currentDate.getTime() - mediaDateLong; if (diff < IG_MEDIA_PHOTOS_RANGE) { return true; }/* w ww. ja v a 2 s.c o m*/ } return false; }
From source file:Main.java
public static Long[] collectionToArray(Collection<String> collection) { if (collection == null || collection.isEmpty()) { return null; }//from ww w . ja v a 2s . c o m Long[] arry = new Long[collection.size()]; int index = 0; for (String value : collection) { arry[index++] = Long.valueOf(value); } return arry; }
From source file:Main.java
/** * Helper method used to get default value for wrappers used for primitive types * (0 for Integer etc)/*from w w w. java 2 s. c o m*/ */ public static Object defaultValue(Class<?> cls) { if (cls == Integer.TYPE) { return Integer.valueOf(0); } if (cls == Long.TYPE) { return Long.valueOf(0L); } if (cls == Boolean.TYPE) { return Boolean.FALSE; } if (cls == Double.TYPE) { return Double.valueOf(0.0); } if (cls == Float.TYPE) { return Float.valueOf(0.0f); } if (cls == Byte.TYPE) { return Byte.valueOf((byte) 0); } if (cls == Short.TYPE) { return Short.valueOf((short) 0); } if (cls == Character.TYPE) { return '\0'; } throw new IllegalArgumentException("Class " + cls.getName() + " is not a primitive type"); }
From source file:Main.java
public static Long longFromString(String s) { s = s.replace(",", "").replace(".", "").replace(" ", ""); try {/*from w w w . java 2 s .c o m*/ return Long.valueOf(s); } catch (Exception e) { e.printStackTrace(); } return 0l; }
From source file:Main.java
/** * //from ww w . j a v a 2 s. c om * @param cc_time * @return */ @SuppressLint("SimpleDateFormat") public static String getStrTime(String cc_time) { String re_time = ""; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long lcc_time = Long.valueOf(cc_time); re_time = sdf.format(new Date(lcc_time)); return re_time; }
From source file:Main.java
public static <K> Map<K, Long> convertMapValueToLong(Map<K, String> map) { Map<K, Long> covertedResult = new HashMap<K, Long>(map.size()); Set<Entry<K, String>> entrySet = map.entrySet(); for (Entry<K, String> entry : entrySet) { covertedResult.put(entry.getKey(), Long.valueOf(entry.getValue().trim())); }// w ww . j ava2 s. c o m return covertedResult; }
From source file:Main.java
public static Vector<Long> convertToVectorOfLongs(long[] a_aLongArray) /* */ {/*from w ww .ja v a 2 s . c o m*/ /* 487 */Vector vecReturn = null; /* 488 */if (a_aLongArray != null) /* */ { /* 490 */vecReturn = new Vector(a_aLongArray.length); /* 491 */for (long lLong : a_aLongArray) /* */ { /* 493 */vecReturn.add(Long.valueOf(lLong)); /* */} /* */} /* */ /* 497 */return vecReturn; /* */}