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
import java.io.IOException; | |
import java.time.Duration; | |
import java.util.Arrays; | |
import java.util.logging.Level; | |
import java.util.logging.Logger; | |
import java.util.stream.Collectors; | |
public class ConsoleLoadBar { | |
private static final Logger LOGGER = Logger.getLogger(ConsoleLoadBar.class.getSimpleName()); |
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
import java.util.Objects; | |
import java.util.function.Predicate; | |
import java.util.function.Supplier; | |
public class Contact { | |
private final String name; | |
private final String number; | |
private final String cpf; | |
private final String address; |
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
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.net.URL; | |
import java.net.URLConnection; | |
import java.util.stream.Collectors; | |
public class HasteBin { |
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
public void checkUpdate(){ | |
String version = this.getDescription().getVersion(); | |
try { | |
//Abrindo conexão | |
URL url = new URL("https://api.github.com/repos/User/Repositório/releases/latest"); | |
URLConnection connection = url.openConnection(); | |
//Convertendo dados | |
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); |
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
import org.junit.Test; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.GregorianCalendar; | |
import static junit.framework.TestCase.*; | |
public class BarcodeUtilsTest { |
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
public class DocumentUtil { | |
// CPF | |
private static final int[] WEIGHT_SSN = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2}; | |
// CNPJ | |
private static final int[] WEIGHT_TFN = {6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2}; | |
private static int sum(int[] weight, char[] numbers, int length) { | |
if (length <= 0) return 0; |