Example usage for java.lang Long Long

List of usage examples for java.lang Long Long

Introduction

In this page you can find the example usage for java.lang Long Long.

Prototype

@Deprecated(since = "9")
public Long(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Long object that represents the long value indicated by the String parameter.

Usage

From source file:Main.java

public static void main(String[] args) {
    Long l = new Long("12345678");

    // assign the bigdecimal value of l to bg scale is 4
    BigDecimal bg = BigDecimal.valueOf(l, 4);

    System.out.println(bg);/* w  w  w. j av a 2 s.co  m*/
}

From source file:Main.java

public static void main(String[] args) {

    Long l = new Long(123456789L);

    BigInteger bi = BigInteger.valueOf(l);

    System.out.println(bi);//  w w  w.j av a 2s .c o m
}

From source file:Main.java

public static void main(String[] args) {
    Class cls = Long.class;

    Long l = new Long(8);
    Double d = new Double(3.5);

    // checking for Long instance
    boolean retval = cls.isInstance(l);
    System.out.println(l + " is Long ? " + retval);

    // checking for Long instance
    retval = cls.isInstance(d);/*  w  ww .  java2s.co m*/
    System.out.println(d + " is Long ? " + retval);
}

From source file:Main.java

public static void main(String[] args) {
    HashSet<Long> hashSet = new HashSet<Long>();
    hashSet.add(new Long("1111111111"));
    hashSet.add(new Long("2222222222"));
    hashSet.add(new Long("3333333333"));
    hashSet.add(new Long("4444444444"));
    hashSet.add(new Long("5555555555"));

    Object obj = Collections.max(hashSet);
    System.out.println(obj);/*from  ww w .ja va 2s  . co m*/
}

From source file:Main.java

public static void main(String[] args) {
    HashSet<Long> hashSet = new HashSet<Long>();

    hashSet.add(new Long("9"));
    hashSet.add(new Long("4"));
    hashSet.add(new Long("2"));
    hashSet.add(new Long("2"));
    hashSet.add(new Long("3"));

    Object obj = Collections.min(hashSet);
    System.out.println("Minimum Element of Java HashSet is : " + obj);
}

From source file:Main.java

public static void main(String[] args) {
    HashSet<Long> hashSet = new HashSet<Long>();

    hashSet.add(new Long("9"));
    hashSet.add(new Long("4"));
    hashSet.add(new Long("2"));
    hashSet.add(new Long("2"));
    hashSet.add(new Long("3"));

    Object obj = Collections.min(hashSet);
    System.out.println("Minimum Element of HashSet is : " + obj);
}

From source file:Main.java

public static void main(String[] args) {
    HashSet<Long> hashSet = new HashSet<Long>();
    hashSet.add(new Long("1111111111"));
    hashSet.add(new Long("2222222222"));
    hashSet.add(new Long("3333333333"));
    hashSet.add(new Long("4444444444"));
    hashSet.add(new Long("5555555555"));

    Object obj = Collections.max(hashSet);
    //Object obj = Collections.min(hashSet);
    System.out.println(obj);//w ww  . j  av a 2 s  . c o m
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Item bean = new Item();
    bean.setId(new Long(1));
    bean.setItemName("a");
    bean.setItemColour("Red");
    bean.setItemQuantities(new Integer(100));

    XMLEncoder encoder = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("Bean.xml")));

    encoder.writeObject(bean);//ww w .  j a v  a2 s. c o m
    encoder.close();
}

From source file:Main.java

public static void main(String[] args) {
    Set<Object> set = new HashSet<Object>();
    set.add("A");
    set.add(new Long(10));
    set.add(new Date());

    List<Object> list = new ArrayList<Object>(set);
    for (int i = 0; i < list.size(); i++) {
        Object o = list.get(i);/*from w ww .  j  av a  2s  . c om*/
        System.out.println("Object = " + o);
    }
}

From source file:Main.java

public static void main(String[] args) {
    Set<Object> set = new HashSet<Object>();
    set.add("A");
    set.add(new Long(10));
    set.add(new Date());

    List<Object> list = new ArrayList<Object>(set);
    Object[] objects = list.toArray();

    for (int i = 0; i < objects.length; i++) {
        Object object = objects[i];
        System.out.println("Object = " + object);
    }//from w  w  w .java 2 s .c o  m
}