forked from Pooja0509/testDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBigIntegerInstantiation.java
71 lines (63 loc) · 1.91 KB
/
BigIntegerInstantiation.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import java.math.BigInteger;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
import java.net.*;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.lang.IllegalArgumentException;
class BigIntegerInstantiation{
private static List<Integer> integers = new ArrayList<Integer>();
public static void main(String args[]){
BigInteger bigInteger = new BigInteger("1");
BigInteger bigInteger2 = new BigInteger("0");
BigInteger bigInteger3 = BigInteger.ONE;
int n=4;
for (int i = 2; i <=n ; i++){
bigInteger = bigInteger.multiply(BigInteger.valueOf(i));
}
System.out.println("Factorial of 4 : "+bigInteger);
try {
addInteger(1);
} catch (IllegalArgumentException iae) {
iae.printStackTrace();
}
try {
SSLContext context1 = SSLContext.getInstance("SSL");
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
SSLContext context = SSLContext.getInstance("TLS");
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Socket soc = new Socket("www.google.com",80);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
Socket soc1 = SSLSocketFactory.getDefault().createSocket("www.google.com", 443);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void addInteger(Integer value){
if (integers.contains(value)) {
new IllegalArgumentException("Integer already added.");
}
integers.add(value);
}
}