Skip to content

Instantly share code, notes, and snippets.

View sunmeat's full-sized avatar
🐈
MEOW

Oleksandr Zahoruiko sunmeat

🐈
MEOW
View GitHub Profile
@sunmeat
sunmeat / gist:2b659e7adbc302f3e643
Created January 26, 2016 22:18
code sample for Android-8 (one-dimensional arrays)
package com.sunmeat;
public class Program {
public static void main(String[] args) {
int size = 10;
int[] ar = new int[size];
// заполнение массива циклом
@sunmeat
sunmeat / main.java
Last active December 12, 2021 17:30
bogosort code example for android 8
package yourPackage;
import java.util.Arrays;
import java.util.Random;
public class YourClassName {
public static void main(String[] args) {
Random random = new Random();
@sunmeat
sunmeat / main.java
Last active December 12, 2021 17:30
bubble sort example for android 8
package com.alex.sorting;
public class JavaApplication1 {
public static void main(String[] args) {
int size = 10;
int ar[] = new int[size];
// before sort
@sunmeat
sunmeat / main.java
Last active December 12, 2021 17:30
selection sort code example for android 8
package yourPackage;
public class YourClassName {
public static void main(String[] args) {
int size = 10;
int ar[] = new int[size];
// before sort
@sunmeat
sunmeat / main.java
Last active December 12, 2021 17:31
insertion sort code example for android 8
package yourPackage;
public class YourClassName {
public static void main(String[] args) {
int size = 10;
int ar[] = new int[size];
// before sort
@sunmeat
sunmeat / main.java
Last active December 12, 2021 17:32
quick sort code example
package yourPackage;
public class YourClassName {
public static void quickSort(int mass[], int start, int end) {
int L = start, R = end;
int M = mass[(start + end) / 2];
do {
@sunmeat
sunmeat / main.java
Last active August 6, 2024 07:05
regex first example
package com.alex.regex;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class YourClassName {
public static void main(String[] args) {
String text = "Бла бла бла... Сегодня курс доллара составляет 47.97 грн.";
@sunmeat
sunmeat / main.java
Last active August 6, 2024 07:06
regex second example
package com.alex.regex;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class YourClassName {
public static void main(String[] args) {
// IP адрес
@sunmeat
sunmeat / main.java
Last active August 6, 2024 07:09
methods example # 3
package com.alex.methods;
public class JavaApplication1 {
static void swap(int a, int b) {
int temp = a;
a = b;
b = temp;
}
@sunmeat
sunmeat / main.java
Last active August 6, 2024 07:10
reference copy
package com.alex.methods;
import java.util.Arrays;
public class JavaApplication1 {
static void changeArray(int[] ar) {
ar[0] = 100;
}