Java Number Sum sumaMesFull(String sF, int n)

Here you can find the source of sumaMesFull(String sF, int n)

Description

suma Mes Full

License

Apache License

Declaration

public static final String sumaMesFull(String sF, int n) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final String sumaMesFull(String sF, int n) {
        int n0 = Math.abs(n);
        String sF0 = sF;/*ww w.jav a  2  s .co  m*/
        for (int i = 0; i < n0; i++) {
            sF0 = incMesFull(sF0);
        }
        return sF0;
    }

    public static final String incMesFull(String sFec0) {
        int nDia = Integer.parseInt(sFec0.substring(0, 2));
        int nMes = Integer.parseInt(sFec0.substring(3, 5));
        int nAno = Integer.parseInt(sFec0.substring(6, 10));
        //
        if (nDia == 31) {
            nDia = 30;
        }
        nMes += 1;
        if (nMes == 13) {
            nMes = 1;
            nAno += 1;
        }
        return makeDateFormatFull(nDia, nMes, nAno);
    }

    public static final String makeDateFormatFull(int nDay, int nMonth, int nYear) {
        String sRes = padNmbFull(nDay, 2, "0") + "/" + padNmbFull(nMonth, 2, "0") + "/" + padNmbFull(nYear, 4, "0");
        return sRes;
    }

    public static final String padNmbFull(int nStr, int nLen, String sChr) {
        String sRes = String.valueOf(nStr);
        if (String.valueOf(nStr).length() < nLen) {
            for (int rm = 0; rm < (nLen - String.valueOf(nStr).length()); rm++) {
                sRes = sChr + sRes;
            }
        }
        return sRes;
    }
}

Related

  1. sum(String fieldName)
  2. sum(String str11, String str22)
  3. sum0ToN(int n)
  4. sum_quad(long max)
  5. sum_quad_endrec(long max)
  6. sumAsDouble(Iterable values)
  7. SumDiffErr(float Term1Err, float Term2Err)
  8. sumDigits(String number)
  9. sumDivisors(int n)