Практика
This commit is contained in:
+10
-11
@@ -1,17 +1,16 @@
|
|||||||
import java.time.*;
|
import java.util.Scanner;
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class TaskDemo {
|
public class TaskDemo {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
String[] color = {"FFFFFF", "000000", "E7495B", "333333"};
|
||||||
ZoneId tokyoZone = ZoneId.of("Asia/Tokyo");
|
System.out.println(findColor(color,"E7495B"));
|
||||||
|
}
|
||||||
ZonedDateTime tokyoTime = ZonedDateTime.now(tokyoZone);
|
public static boolean findColor(String[] pallete, String target) {
|
||||||
|
for (int i = 0; i < pallete.length; i++) {
|
||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
if (pallete[i].equalsIgnoreCase(target)) {
|
||||||
String uiText = tokyoTime.format(formatter);
|
return true;
|
||||||
System.out.println("Точное время в Токио: " + uiText);
|
}
|
||||||
|
} return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user