Skip to content

Instantly share code, notes, and snippets.

View Yur-ok's full-sized avatar

Yuriy Bachevskiy Yur-ok

  • WorldWideWeb
View GitHub Profile
@Yur-ok
Yur-ok / SecondsIn3Weeks.java
Created December 4, 2015 15:07
How much seconds in 3 weeks?
package FirstProgramm;
/**
* Created by Юрий on 04.12.2015.
*/
public class SecondsIn3Weeks {
public static void main(String[] args) {
System.out.println(30 * 60 * 24 * 21);
}
}
@Yur-ok
Yur-ok / Strings.java
Created December 4, 2015 17:41
Примеры того как ведут себя строки
package SecondProgramm;
/**
* Created by Юрий on 05.12.2015.
*/
public class Strings {
public static void main(String[] args) {
String someText = "Some text";
String st1 = "First ";
String st2 = "Second";
@Yur-ok
Yur-ok / StringLength.java
Created December 4, 2015 17:47
Пример использования метода length()
package SecondProgramm;
/**
* Created by Юрий on 05.12.2015.
*/
public class StringLength {
public static void main(String[] args) {
String name = "Yuriy";
System.out.println(name.length());
}
@Yur-ok
Yur-ok / LastSymbol.java
Created December 4, 2015 18:11
Находим послдений символ в строке, в не зависимости от того как меняется сама строка.
package SecondProgramm;
/**
* Created by Юрий on 05.12.2015.
*/
public class LastSymbol {
public static void main(String[] args) {
String mjQuote = "I'm failed over and over and over again in my life and that is why I succeed!";
System.out.println(mjQuote.charAt(mjQuote.length()-1));
@Yur-ok
Yur-ok / Succeed.java
Created December 4, 2015 18:42
Поиск подстроки
package Lesson1_frame4;
/**
* Created by Юрий on 05.12.2015.
*/
public class Succeed {
public static void main(String[] args) {
String mjQuote = "I'm failed over and over and over again in my life and that is why I succeed!";
@Yur-ok
Yur-ok / Again.java
Created December 5, 2015 14:21
Substring "again" without counting characters
package Lesson1_frame4;
/**
* Created by Юрий on 05.12.2015.
*/
public class Again {
public static void main(String[] args) {
String mjQuote = "I'm failed over and over and over again in my life and that is why I succeed!";
@Yur-ok
Yur-ok / Replace.java
Created December 5, 2015 14:34
Replace "smile" to ":)"
package Lesson1_frame4;
/**
* Created by Юрий on 05.12.2015.
*/
public class Replace {
public static void main(String[] args) {
String mtQoute = "Let us always meet each other with smile, for the smile is the beginning of love.";
@Yur-ok
Yur-ok / MapOfBattleField.java
Created December 5, 2015 16:36
Map of battle field
package Lesson1_frame5;
/**
* Created by Юрий on 05.12.2015.
*/
public class MapOfBattleField {
public static void main(String[] args) {
System.out.println("B B B B B B B B B B");
System.out.println("C B B B C B B B C");
@Yur-ok
Yur-ok / TimeMillis.java
Created December 5, 2015 18:16
D:H:M:S
package Lesson1_frame5;
/**
* Created by Юрий on 05.12.2015.
*/
public class TimeMillis {
public static void main(String[] args) {
long ms = System.currentTimeMillis();
System.out.println(ms);
@Yur-ok
Yur-ok / DoubleValue.java
Created December 5, 2015 19:04
25.6 => 25 и 6
package Lesson1_frame5;
/**
* Created by Юрий on 06.12.2015.
*/
public class DoubleValue {
public static void main(String[] args) {
double value = 25.6;
String val = String.valueOf(value);
System.out.println(val.substring(0,2));