![JAR search and dependency download from the Maven repository](/logo.png)
com.github.andyshao.system.PrintChar Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Gear Show documentation
Show all versions of Gear Show documentation
Enhance and formating the coding of JDK
The newest version!
package com.github.andyshao.system;
import com.github.andyshao.reflect.ArrayOperation;
/**
*
* Title:
* Descript:
* Copyright: Copryright(c) Apr 25, 2016
* Encoding:UNIX UTF-8
*
* @author Andy.Shao
*
*/
public class PrintChar implements Task {
/**keywords*/
public static final String KEY_WORDS = "-printChar";
private volatile Task nextTask = Task.EMPTY_TASK;
@Override
public Task getNextTask() {
return this.nextTask;
}
@Override
public boolean isDuty(String[] args) {
if (args == null || args.length == 0) return false;
else return args[0].equals(PrintChar.KEY_WORDS);
}
@Override
public void process(String[] args) {
if (args.length < 2) args = ArrayOperation.mergeArray(String[].class , args , new String[] { String.valueOf((int) 'α') , String.valueOf((int) 'ω') });
final int startPosition = Integer.valueOf(args[1]);
int endposition = startPosition;
if (args.length >= 3) endposition = Integer.valueOf(args[2]);
for (int i = startPosition ; i <= endposition ; i++) {
System.out.print((char) i + " ");
if ((i - startPosition + 1) % 5 == 0) System.out.println();
}
}
/**
* set next task
* @param nextTask next task
*/
public void setNextTask(Task nextTask) {
this.nextTask = nextTask;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy