-
Notifications
You must be signed in to change notification settings - Fork 0
/
dontpad.txt
72 lines (44 loc) · 1.68 KB
/
dontpad.txt
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
71
Caelum - FJ 22 - Sala 144
# Conteúdo sobre o Maven
--- para resolver problemas de dependencia
Botao direito no projeto, escolher Maven -> update project
clicar em "Force update of Snapshots/Releases
https://mvnrepository.com/artifact/org.hibernate/hibernate-core/5.2.6.Final
- Repositório Remoto
Nexus Repository > https://www.sonatype.com/product-nexus-repository
Artifactory OSS > https://www.jfrog.com/confluence/display/RTF5X/Building+Artifactory+OSS
# Simulação com BigDecimal e com Double
package br.com.caelum;
import java.math.BigDecimal;
public class BigDecimalExemplo {
public static void main(String[] args) {
System.out.println("INICIO - Exemplo de Double e BigDecimal \n");
double valor1 = 0.1;
double valor2 = 0.2;
System.out.println(valor1 + valor2);
/* Calculo com Double */
calculoComDouble();
/* Calculo com BigDecimal */
calculoComBigDecimal();
}
public static void calculoComDouble() {
System.out.println("\n INICIO - calculoComDouble - Forma incorreta!! \n");
System.out.println(2.00 - 1.1);
System.out.println(2.00 - 1.2);
System.out.println(2.00 - 1.3);
System.out.println(2.00 - 1.4);
System.out.println(2.00 - 1.5);
System.out.println(2.00 - 1.6);
System.out.println(2.00 - 1.7);
System.out.println(2.00 - 1.8);
System.out.println(2.00 - 1.9);
System.out.println(2.00 - 2);
}
public static void calculoComBigDecimal() {
System.out.println("\n INICIO - calculoComBigDecimal - Forma correta! \n");
BigDecimal big1 = new BigDecimal("0.1");
BigDecimal big2 = new BigDecimal("0.2");
BigDecimal bigResult = big1.add(big2);
System.out.println(bigResult.toString());
}
}