Subato

FunGraph

public final class FunGraph {
  private FunGraph(){}

  static String mkStringGraph(int xMin,int xMax,int yMin,int yMax){
    String result="";
    for (int y=yMax;y>= yMin;y--){
      for (int x= xMin;x <= xMax;x++){
        if (x*x<=y && (x+1)*(x+1)>y 
            || x*x<=y && (x-1)*(x-1)>y){
          result+="*";
        }else if(x==0){
          result+="|";          
        }else if(y==0){
          result+="-";          
        }else{
          result+=" ";          
        }
      }
      result += "\n";
    }
    return result;
  }
}