public double extractFloatData(byte[] pachSourceData,int nMaxBytes,MutableInt pnConsumedBytes){
switch (pszFormatString.charAt(0)) {
case 'A':
case 'I':
case 'R':
case 'S':
case 'C':
    String dataString=extractStringData(pachSourceData,nMaxBytes,pnConsumedBytes);
  if (dataString.length() == 0) {
    return 0;
  }
try {
  return Double.parseDouble(dataString);
}
 catch (NumberFormatException nfe) {
  if (Debug.debugging("iso8211")) {
    Debug.output("DDFSubfieldDefinition.extractFloatData: number format problem: " + dataString);
  }
  return 0;
}
case 'B':
case 'b':
byte[] abyData=new byte[8];
if (pnConsumedBytes != null) {
pnConsumedBytes.value=nFormatWidth;
}
if (nFormatWidth > nMaxBytes) {
Debug.error("DDFSubfieldDefinition: format width is greater than max bytes for float");
return 0.0;
}
System.arraycopy(pachSourceData,0,abyData,0,nFormatWidth);
switch (eBinaryFormat) {
case DDFBinaryFormat.UInt:
case DDFBinaryFormat.SInt:
case DDFBinaryFormat.FloatReal:
return (int)pszFormatString.charAt(0) == 'B' ? MoreMath.BuildIntegerBE(abyData) : MoreMath.BuildIntegerLE(abyData);
case DDFBinaryFormat.NotBinary:
case DDFBinaryFormat.FPReal:
case DDFBinaryFormat.FloatComplex:
return 0.0;
}
break;
default :
}
return 0.0;
}

public double extractFloatData ( byte [ ] pachSourceData , int nMaxBytes , MutableInt pnConsumedBytes ) { switch ( pszFormatString . charAt ( 0 ) ) { case 'A' : case 'I' : case 'R' : case 'S' : case 'C' : String dataString = extractStringData ( pachSourceData , nMaxBytes , pnConsumedBytes ) ; if ( dataString . length ( ) == 0 ) { return 0 ; } try { return Double . parseDouble ( dataString ) ; } catch ( NumberFormatException nfe ) { if ( Debug . debugging ( "iso8211" ) ) { Debug . output ( "DDFSubfieldDefinition.extractFloatData: number format problem: " + dataString ) ; } return 0 ; } case 'B' : case 'b' : byte [ ] abyData = new byte [ 8 ] ; if ( pnConsumedBytes != null ) { pnConsumedBytes . value = nFormatWidth ; } if ( nFormatWidth > nMaxBytes ) { Debug . error ( "DDFSubfieldDefinition: format width is greater than max bytes for float" ) ; return 0.0 ; } System . arraycopy ( pachSourceData , 0 , abyData , 0 , nFormatWidth ) ; switch ( eBinaryFormat ) { case DDFBinaryFormat . UInt : case DDFBinaryFormat . SInt : case DDFBinaryFormat . FloatReal : return ( int ) pszFormatString . charAt ( 0 ) == 'B' ? MoreMath . BuildIntegerBE ( abyData ) : MoreMath . BuildIntegerLE ( abyData ) ; case DDFBinaryFormat . NotBinary : case DDFBinaryFormat . FPReal : case DDFBinaryFormat . FloatComplex : return 0.0 ; } break ; default : } return 0.0 ; }
extract a subfield value as a float . given a pointer to the data for this subfield ( from within a ddfrecord ) this method will return the floating point data for this subfield . the number of bytes consumed as part of this field can also be fetched . this method may be called for any type of subfield , and will return zero if the subfield is not numeric .
