title: What is the best approach for serializing BigDecimal/BigInteger to ProtocolBuffers
body: <p>I am starting to migrate a custom serialization mechanism to Protocol Buffers. One data type that will be used particularly regularly is <code>BigDecimal</code>.</p>
  
  <p>Does anyone know of a good way of serializing this within Protocol Buffers? Our current serialization routine uses <code>BigDecimal.toPlainString()</code> for serialization, and <code>new BigDecimal(String)</code> for deserialization - I'm assuming there's a better way.</p>
  
  <p>My guess is to define a <code>BigDecimal</code> as:</p>
  
  <pre><code>message BDecimal {
      required int32 scale = 1;
      required BInteger int_val = 2;
  }
  </code></pre>
  
  <p>But I am not too sure how to define <code>BigInteger</code> - perhaps using its <code>toByteArray()</code> method?</p>