public byte[] getEncoded() {
        final byte[] data = new byte[2*length];
        ByteArrayUtils.copyAdjustedLength(r.toByteArray(), length, data, 0);
        ByteArrayUtils.copyAdjustedLength(s.toByteArray(), length, data, length);
        return data;
    }
@Test
    public void shouldEncode() {
        assertArrayEquals(new byte[] { 0, 0, 0, 1, 0, 0, 0, 10},
            new EcSignature(4, BigInteger.ONE, BigInteger.TEN).getEncoded());
    }