import java.math.BigInteger;
import java.util.Random;

public class JavaObjects {

	public static void main(String[] args) {
		//wrapper classes for primitives
		// e.g. int has the wrapper class Integer
		
		//deprectated, there is a better way
		Integer x1 = new Integer(5);
		Integer x2 = Integer.valueOf(5);
		//auto-boxing - convert int to Integer
		Integer x3 = 5;
		//auto-unboxing - convert Integer to int
		int y = x3;  
		
		//convert from String to int
		int z = Integer.parseInt("12345");
		
		//Random numbers
		Random rng = new Random(31);
		for(int i = 0; i < 10; i++) {
			int rand1 = (int)(Math.random()*10);
			int rand2 = rng.nextInt(10);
			
			System.out.printf("rand1 == %d. rand2 == %d\n", rand1, rand2);
		}
		
		//Strings - change references, but not contents
		String s = "Hello";
		s = "Hi there";
		
		//Strings are immutable
		//Mutable String classes: StringBuffer and StringBuilder
		
		StringBuilder word = new StringBuilder("Hello");
		//can change the values
		word.setCharAt(0, 'h');
		word.append(" How are you?");
		
		
		//uses toString to convert to a String
		System.out.println(word);
		
		
		//arbitrary range
		//BigInteger, BigDecimal
		BigInteger i = new BigInteger("10000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
		BigInteger j = new BigInteger("9999999999999999999999999999999999999999");
		
		System.out.println(i.multiply(j));
		
	}

}
