public String doubleOut(Double doubleDown)
{
StringBuffer p = new StringBuffer();
+ if(doubleDown.doubleValue() < 0) {
+ doubleDown = new Double(-doubleDown.doubleValue());
+ p.append("-");
+ }
double trouble = doubleDown.doubleValue() % 1;
if(trouble > 0.950)
{
{
String doubleString = new String(doubleDown+"");
int decimal = doubleString.indexOf(".");
- p.append(doubleString.substring(0, decimal));
+ if(decimal != -1) {
+ p.append(doubleString.substring(0, decimal));
- if ((doubleString.length() - decimal) > 6)
- {
- p.append(doubleString.substring(decimal,decimal+6));
- }
- else
- {
- p.append(doubleString.substring(decimal));
+ if ((doubleString.length() - decimal) > 6)
+ {
+ p.append(doubleString.substring(decimal,decimal+6));
+ }
+ else
+ {
+ p.append(doubleString.substring(decimal));
+ }
+ } else {
+ p.append(doubleString);
}
}
return(p.toString());
{
StringBuffer p = new StringBuffer();
+ if(doubleDown < 0) {
+ doubleDown = -doubleDown;
+ p.append("-");
+ }
double trouble = doubleDown % 1;
if(trouble > 0.950)
{
String doubleString = new String(doubleDown+"");
int decimal = doubleString.indexOf(".");
- p.append(doubleString.substring(0, decimal));
+ if(decimal != -1) {
+ p.append(doubleString.substring(0, decimal));
- if ((doubleString.length() - decimal) > 6)
- {
- p.append(doubleString.substring(decimal,decimal+6));
- }
- else
- {
- p.append(doubleString.substring(decimal));
+ if ((doubleString.length() - decimal) > 6)
+ {
+ p.append(doubleString.substring(decimal,decimal+6));
+ }
+ else
+ {
+ p.append(doubleString.substring(decimal));
+ }
+ } else {
+ p.append(doubleString);
}
}
return(p.toString());