private static final void splitSamplesToBytes(int[] samples, int totalSamples,
    int bytesPerSample, byte[] dataMD5) {
    int destIndexBase = 0;
    int i = 0;
    
    switch(bytesPerSample) {
      case 3:
        for(; i < totalSamples; i++) {
        dataMD5[destIndexBase++] = (byte)(samples[i]);
        dataMD5[destIndexBase++] = (byte)(samples[i] >> 8);
        dataMD5[destIndexBase++] = (byte)(samples[i] >> 16);
        }
        break;
      case 2:
        for(; i < totalSamples; i++) {
        dataMD5[destIndexBase++] = (byte)(samples[i]);
        dataMD5[destIndexBase++] = (byte)(samples[i] >> 8);
        }
        break;
      case 1:
        for(; i < totalSamples; i++) {
        dataMD5[i] = (byte)samples[i];
        }
    }
  }
private static final void splitSamplesToBytes ( int [ ] samples , int totalSamples , int bytesPerSample , byte [ ] dataMD5 ) { int destIndexBase = 0 ; int i = 0 ; switch ( bytesPerSample ) { case 3 : for ( ; i < totalSamples ; i ++ ) { dataMD5 [ destIndexBase ++ ] = ( byte ) ( samples [ i ] ) ; dataMD5 [ destIndexBase ++ ] = ( byte ) ( samples [ i ] > > 8 ) ; dataMD5 [ destIndexBase ++ ] = ( byte ) ( samples [ i ] > > 16 ) ; } break ; case 2 : for ( ; i < totalSamples ; i ++ ) { dataMD5 [ destIndexBase ++ ] = ( byte ) ( samples [ i ] ) ; dataMD5 [ destIndexBase ++ ] = ( byte ) ( samples [ i ] > > 8 ) ; } break ; case 1 : for ( ; i < totalSamples ; i ++ ) { dataMD5 [ i ] = ( byte ) samples [ i ] ; } } }
/* Split Samples to bytes(for sending to MD5)
CURRENTLY ONLY MAY WORK FOR: sample sizes which are divisible by 8. Need
to create some audio to test with.