Package Pkgfirst;
import org.junit.Test;
Public class range{
/**
* Funname:println
* Description: Simple print, instead of System.out.println (object)
* @param: Object being print
* @return String:none
* @Author: Bingoreo
* @Create date:2015-07-15
**/
Public static void println (Object obj) {
System.out.println (obj);
}
/**
* Funname:println
* Description: Simple print, instead of System.out.print (object)
* @param: Object
* @return String:none
* @Author: Bingoreo
* @Create date:2015-07-15
**/
Public static void print (Object obj) {
System.out.print (obj);
}
/**
* Funname:println
* Description: Simple print, instead of System.out.println ()
* @param: None
* @return String:none
* @Author: Bingoreo
* @Create date:2015-07-15
**/
Public static void println () {
System.out.println ();
}
@Test
/**
* Funname:range
* Description: Generates an array from 0 to N, each step 1
* @param: int n
* @return String: Returns an array
* @Author: Bingoreo
* @Create date:2015-07-15
**/
Public Static int[] range (int n) {
if (n <=0)
return null;
else {
int[] Incount = new Int[n];
for (int i =0; i<n; i++) {
Incount[i] = i;
}
return incount;
}
}
@Test
/**
* Funname:range
* Description: Generates an array from start to End-1, each step 1
* @param: Start, start
* @return String: Returns an array
* @Author: Bingoreo
* @Create date:2015-07-15
**/
Public Static int[] Range (int start, int end) {
if (start >= end)
return null;
else{
int[] Incount = new Int[end-start];
for (int i =0; i<end-start; i++) {
Incount[i] = End-start + i;
}
return incount;
}
}
/**
* Funname:range
* Description: Generates an array from start to end, stepping step at a time
* @param: Start, End,step
* @return String: Returns an array
* @Author: Bingoreo
* @Create date:2015-07-15
**/
Public Static int[] Range (int start, int end, int step) {
if (start >= end)
return null;
else{
int n = (end-start)/step + 1;
int[] Incount = new Int[n];
for (int i =0; i<n; i++) {
Incount[i] = (end-start) + step*i;
}
return incount;
}
}
Public static void Main (string[] args) {
//TODO auto-generated method stub
//simpleprintone sp = new Simpleprintone ();
//sp.println ("Simple println");
//sp.print ("simple print");
//for (int x:range (10,20,12))
//system.out.print (x+ "");
}
}
Three methods in the range class and simple printing