Skip to content

Commit

Permalink
Base64
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagogomes187 committed Aug 27, 2023
1 parent c5a0bb3 commit 58fd4a2
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Base64/Base64.iml
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>
25 changes: 25 additions & 0 deletions Base64/src/Base64Exemplo.java
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){

}

}

}
11 changes: 11 additions & 0 deletions StringJoiner/StringJoiner.iml
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>
29 changes: 29 additions & 0 deletions StringJoiner/src/StringJoinerExemplo.java
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);

}

}

0 comments on commit 58fd4a2

Please sign in to comment.