Code:
int
number = 5;
if(++number == 6)
{
System.out.println("Hello.");
}
if(number-- == 5)
{
System.out.println("Goodbye");
}
Or
Or just plain useful methods like this for sorting arrays
Code:
public static void swap(int [] num, int i, int j)
{
int tmp = num[i];
num[i] = num[j];
num[j] = tmp;
}
public static void sort(int [] num)
{
for(int i = 0; i < num.length - 1; i++)
{
int minIndex = i;
for(int j = i + 1; j < num.length; j++)
{
if(num[j] < num[minIndex])
minIndex = j;
}
swap(num, i, minIndex);
}
}