try{
numberHA = CommonFns.toInt(args[0]);
}
//filter out invaild number.
catch(ClassCastException e) {
throw new SSErrorXelException(SSError.NAME);
}
int form = 0;
int paraNum = args.length;
if( paraNum == 2)
{
try {
form = CommonFns.toInt(args[1]);
}
catch(ClassCastException e) {
if(!CommonFns.toBoolean(args[1]))
form = 4;
}
}
// if the input is negative or > 3999, or wrong style parameter, return #VALUE! as MSFT Excel.
if(numberHA < 0 || numberHA > 3999 || form < 0 || form > 4)
{
throw new SSErrorXelException(SSError.VALUE);
}
else
{
//convert Arabic numerical to Roman.
char[] unit = {'I','X','C','M'};