Range类中的三个方法及简单打印
package pkgFirst; import org.junit.Test; public class Range{ /**
* FunName: println
* Description : 简版打印,代替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: print
* Description : 简版打印,代替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 : 简版打印,代替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 : 生成从0到n-1的数组,每次步进1
* @param: int n
* @return String: 返回数组
* @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 : 生成从start到end-1的数组,每次步进1
* @param: start, start
* @return String: 返回数组
* @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 : 生成从start到end的数组,每次步进step
* @param: start, end,step
* @return String: 返回数组
* @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 自动生成的方法存根
//SimplePrintOne sp = new SimplePrintOne();
//sp.println("simple printLn");
//sp.print("simple print");
//for(int x :range(10,20,12))
//System.out.print(x+" "); }
}
Range类中的三个方法及简单打印的更多相关文章
- 创建如下三个类:(People类中的三个方法分别输出一些信息,ChinaPeople 和AmericanPeople类重写父类的三个方法)。
创建如下三个类:(People类中的三个方法分别输出一些信息,ChinaPeople 和AmericanPeople类重写父类的三个方法). ackage com.chuoji.text01; pub ...
- 19.创建如下三个类:(People类中的三个方法分别输出一些信息,ChinaPeople 和AmericanPeople类重写父类的三个方法)。
package zuoye2; public class People { protected double height; protected double weight; private Stri ...
- 孤荷凌寒自学python第二十四天python类中隐藏的私有方法探秘
孤荷凌寒自学python第二十四天python类中隐藏的私有方法探秘 (完整学习过程屏幕记录视频地址在文末,手写笔记在文末) 今天发现了python的类中隐藏着一些特殊的私有方法. 这些私有方法不管我 ...
- python: 面向对象:类和对象调用类中的变量和方法
一. 面向对象初识 我们在生活中做事都是面向过程的,前面实现一些基本逻辑功能代码也是用面向过程的语句实现的,后来学了函数,把这些功能又装到了函数里.但用面向过程的方法去写程序,只能实现一个功能,我们要 ...
- 关于Integer类中parseInt()和valueOf()方法的区别以及int和String类性的转换.以及String类valueOf()方法
Integer类中的. 关于parseInt()方法的API文档. 返回的是int类型的 关于valueOf()方法的API文档 返回的是Integer类型的. 关于intValue()方法的API ...
- org.apache.commons.lang3.StringUtils类中isBlank和isEmpty方法的区别
相信很多java程序员在写代码的时候遇到判断某字符串是否为空的时候会用到StringUtils类中isBlank和isEmpty方法,这两个方法到底有什么区别呢?我们用一段代码来阐述这个区别吧: @T ...
- 在eclispe的类中快速打出main方法
在java类中快速打出main方法有两种途径: 1. 在新建类时,在New Java Class窗口中,将public static void main ( String[ ] args ) 前面打上 ...
- UnSafe类中的一些重要方法
UnSafe类中的一些重要方法 JDK中的rt.jar保重Unsafe类中提供了硬件级别的原子性操作,Unsafe类中的方法都是navtice方法,他们使用JNI的方式访问C++实现库,下面我们来了解 ...
- php面向对象类中常用的魔术方法
php面向对象类中常用的魔术方法 1.__construct():构造方法,当类被实例化new $class时被自动调用的方法,在类的继承中可以继承与覆盖该方法,例: //__construct( ...
随机推荐
- linux下安装配置DHCP服务器
前提是已经安装了 core 及 base 两个组 1 2 3 4 5 # cat /etc/redhat-release Red Hat Enterprise Linux Server relea ...
- linux系统识别和挂载文件系统
1. 使用df 命令查看文件系统及相关挂载点信息 [root@server101 ~]# df Filesystem 1K-blocks Used Available Use% Mounted on ...
- javascript 递归调用
上源码:underscore.js var flatten = function(input, shallow, output) { if (shallow && _.every(in ...
- poj2265
斜坐标系,注意找规律.说明在代码里. e- ?(x):-(x))<eps) ][] = { { , }, { -, }, { -, }, { , - }, { , - }, { , } ...
- CenOS7.1 vncserver@:1.service: control process exited, code=exited status=2
参考:http://www.cnblogs.com/gaohong/p/4829206.html 报错细节: vncserver@:1.service: control process exited, ...
- Eclipse 插件 —— SVN 的下载与安装
介绍一下Eclipse 安装 SVN 插件的方法. 第一步:下载资源文件 打开网址 http://subclipse.tigris.org/ ,点击[Download and Install]标签页, ...
- Cocos2d-x 开发手记
1.所有的源文件统一新建到Classes里,否则无法找到源文件,这样也便于跨平台编译 2.绘图坐标系,与opengl采用相同坐标系,左下角为原点 纹理坐标系,以左上角为原点 3.最近有在学习C ...
- Winform——计算器
namespace 计算器2._0 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } pr ...
- staging server, source congtrol, deply workflow using git
web项目开发中,有三个实践对于项目成功是非常重要的: 1. staging servers 2. Version control workflows 3. Tested, repeatable de ...
- 【笨嘴拙舌WINDOWS】GDI(2)
古时候,大师舞文之时需要笔墨纸伺候,不同笔,不同墨,作品风格迥异! 以下是windows提供的笔(带有墨): CreatePen(PS_SOLID,0,clRed); ...