()
| 71 | } |
| 72 | |
| 73 | public String toString() { |
| 74 | StringBuffer sb = new StringBuffer("PT"); |
| 75 | long absSeconds = Math.abs(seconds); |
| 76 | if (seconds < 0 && absSeconds > 0) { |
| 77 | sb.append('-'); |
| 78 | } |
| 79 | sb.append(absSeconds); |
| 80 | if (nanos != 0) { |
| 81 | sb.append('.'); |
| 82 | String frac = String.valueOf(1000000000L + nanos).substring(1); |
| 83 | while (frac.endsWith("0")) { |
| 84 | frac = frac.substring(0, frac.length() - 1); |
| 85 | } |
| 86 | sb.append(frac); |
| 87 | } |
| 88 | sb.append('S'); |
| 89 | return sb.toString(); |
| 90 | } |
| 91 | } |