Skip to content

Instantly share code, notes, and snippets.

import java.util.Random;
public class MethodsExamples {
public static void main(String[] args) {
int x = getRandomNumber();
helloKitty();
hello("Kitty");
hello("Student");
hello("Teacher");
public static void main(String[] args) {
int year = 1099; // -9999.....9999
// range check
int date = 12;
String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
int month = 12; // -100 - +100 --> valid 1..12
String monthStr = months[month - 1];
import java.util.Random;
import java.util.Scanner;
public class Task02 {
public static void main(String[] args) {
Random rnd = new Random();
int randomInt = rnd.nextInt(11);
import java.util.Random;
import java.util.Scanner;
public class GameWithTimer {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Random rand = new Random();
#!/usr/bin/env node
console.log("Calculating first 100 prime numbers.\n")
var primes = [];
var findPrime = function(primes, check) {
for (i = 0; i < primes.length; i++) {
if (check % primes[i] == 0) {
return false;
}
@cxubrix
cxubrix / EncryptionUtil.java
Created December 17, 2012 08:25
Simple encrypt/decrypt util for url parameters
package lv.org.substance.crypt
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;