This file contains hidden or 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
/* Проверка номера телефона | |
Метод checkTelNumber должен проверять, является ли аргумент telNumber валидным номером телефона. | |
Критерии валидности: | |
1) если номер начинается с '+', то он содержит 12 цифр | |
2) если номер начинается с цифры или открывающей скобки, то он содержит 10 цифр | |
3) может содержать 0-2 знаков '-', которые не могут идти подряд | |
4) может содержать 1 пару скобок '(' и ')' , причем если она есть, то она расположена левее знаков '-' | |
5) скобки внутри содержат четко 3 цифры | |
6) номер не содержит букв | |
7) номер заканчивается на цифру |
This file contains hidden or 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 Encodings | |
{ | |
public static void main(String[] args) throws IOException | |
{ | |
FileInputStream inputStream = new FileInputStream("d:/data.txt"); | |
FileOutputStream outputStream = new FileOutputStream("d:/data.txt"); | |
SortedMap<String, Charset> charsets = Charset.availableCharsets();//список доступных кодировок | |
Charset currentCharset = Charset.defaultCharset();//узнать текущую кодировку |
This file contains hidden or 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.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.function.ToIntFunction; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
import static java.lang.System.out; | |
public class FunctionalJava { |
NewerOlder