1. Java / Говнокод #21468

    −20

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    public static float xTicksBelow(int numTicks, float price){
        float pricePoint = price;
        DecimalFormat threeDigit = new DecimalFormat("0.000");
        for(int i = 0; i < numTicks; i++){
          if(pricePoint > 0.001f && pricePoint < 0.1f && pricePoint > 0){
            pricePoint -= 0.001;
          }else if(pricePoint > 0.1f && pricePoint < 2.0f){
            pricePoint -= 0.005;
          }else if(pricePoint > 2.0f){
            pricePoint -= 0.01f;
          }else if(pricePoint == 0.1f){
            pricePoint -= 0.001;
          }else if(pricePoint == 2.0f){
            pricePoint -= 0.005f;
          }else if(pricePoint == 0.001f){
            pricePoint = 0.001f;
          }
          String  prices = threeDigit.format(pricePoint);
          pricePoint = Float.parseFloat(prices);
        }
        //JOptionPane.showMessageDialog(null, "Pricepoint is now " + pricePoint);
        return pricePoint;
      }

    Запостил: Segfault, 17 Октября 2016

    Комментарии (2) RSS

    Добавить комментарий