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
int[] array = {....}; | |
ArrayList<Integer> list = new ArrayList<Integer>();{ | |
for (int i = 0; i < array.length; i++){ | |
list.add(array[i]); | |
} | |
} | |
for (int i = 0; i < array.length; i++){ | |
array[i] = list.get(i); | |
} |
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 static void main(String[] args) throws IOException { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
String string = reader.readLine(); | |
Arrays.stream(string.split(" ")).forEach(word -> { | |
char[] chars = word.toCharArray(); | |
if (chars.length > 0) { | |
chars[0] = Character.toUpperCase(chars[0]); | |
System.out.print(new String(chars) + " "); | |
} |
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 Solution { | |
public static void main(String[] args) throws Exception { | |
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in)); | |
int sum = 0; | |
while (true) { | |
String s = buffer.readLine(); | |
if (s.equals("сумма")) { | |
break; | |
} |
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 Solution { | |
public static void main(String[] args) throws Exception { | |
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); | |
int a = Integer.parseInt(reader.readLine()); | |
int b = Integer.parseInt(reader.readLine()); | |
int c = Integer.parseInt(reader.readLine()); | |
int d = Integer.parseInt(reader.readLine()); | |
int e = Integer.parseInt(reader.readLine()); |
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 static void displayClosestToTen(int a, int b) { | |
if (abs(10 - a) < abs(10 - b)) { | |
System.out.println(a); | |
} else { | |
System.out.println(b); | |
} | |
} |
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 static int sumDigitsInNumber(int number) { | |
int a = number / 100; | |
int b = (number - a*100) / 10; | |
int c = number - (a*100) - (b*10); | |
int sum = a + b + c; | |
return sum; | |
} |
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
package by.ari.training; | |
public class ChokeTable { | |
public static void main(String[] args) { | |
String table = ""; | |
for (int a = 1; a <= 10; a++) { | |
for (int i = 1; i <= 10; i++) { | |
table = table + (a * i) + " "; |
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 static int min4(int a, int b, int c, int d) { | |
int g = min2(a, b); | |
int f; | |
if (g < c) { | |
if (g < d) | |
f = g; | |
else | |
f = d; | |
} else { | |
if (c < d) |
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 static int min3(int a, int b, int c) { | |
int min; | |
if (a < b) { | |
if (a < c) | |
min = a; | |
else | |
min = c; | |
} else { | |
if (b < c) | |
min = b; |
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 static int min2(int a, int b) { | |
int min; | |
if (a < b) | |
min = a; | |
else | |
min = b; | |
return min; | |
} |