-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c5a0bb3
commit 58fd4a2
Showing
5 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import java.util.Base64; | ||
|
||
public class Base64Exemplo { | ||
|
||
public static void main(String[] args) { | ||
|
||
try{ | ||
|
||
final String textoOriginal = "A classe Base64 no Java 8!"; | ||
System.out.println( "Mensagem original: " + textoOriginal ); | ||
|
||
String textoCodificado = Base64.getEncoder().encodeToString( textoOriginal.getBytes("utf-8") ); | ||
System.out.println( "Mensagem codificada: " + textoCodificado ); | ||
|
||
String textoDecodificado = new String( Base64.getDecoder().decode( textoCodificado ), "utf-8"); | ||
System.out.println( "Mensagem decodificada: " + textoDecodificado ); | ||
|
||
} | ||
catch(Exception e){ | ||
|
||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import java.util.StringJoiner; | ||
import java.util.StringTokenizer; | ||
|
||
public class StringJoinerExemplo { | ||
|
||
public static void main(String[] args) { | ||
String nomes = " João, Pedro, Maria, Ana, Paulo"; | ||
|
||
StringTokenizer st = new StringTokenizer(nomes, ","); | ||
|
||
while(st.hasMoreTokens()){ | ||
System.out.println(st.nextToken()); | ||
} | ||
|
||
/****************************************************/ | ||
|
||
StringJoiner sj = new StringJoiner(", "); | ||
|
||
sj.add("João"); | ||
sj.add("Pedro"); | ||
sj.add("Maria"); | ||
sj.add("Ana"); | ||
sj.add("Paulo"); | ||
|
||
System.out.println(sj); | ||
|
||
} | ||
|
||
} |