private static int squareSum(final int pvalue) {
    int result = 0;
    for (final char valueDigit : String.valueOf(pvalue).toCharArray()) {
      result += Character.digit(valueDigit, 10);
    }
    return result;
  }
private static int squareSum ( final int pvalue ) { int result = 0 ; for ( final char valueDigit : String . valueOf ( pvalue ) . toCharArray ( ) ) { result += Character . digit ( valueDigit , 10 ) ; } return result ; }
calculate square sum.

@param pvalue value to calculate square sum for
@return square sum