protected static Ptg calcBin2Dec( Ptg[] operands )
	{
		if( operands.length < 1 )
		{
			return new PtgErr( PtgErr.ERROR_NULL );
		}
		debugOperands( operands, "BIN2DEC" );
		String bString = operands[0].getString().trim();
		// 10 bits at most
		if( bString.length() > 10 )
		{
			return new PtgErr( PtgErr.ERROR_NUM );
		}
		// must det. manually if binary string is negative because parseInt does not
		// handle two's complement input!!!
		boolean bIsNegative = ((bString.length() == 10) && bString.substring( 0, 1 ).equalsIgnoreCase( "1" ));

		int dec = 0;
		try
		{
			dec = Integer.parseInt( bString, 2 );
			if( bIsNegative )
			{
				dec -= 1024;    // 2^10 (= signed 11 bits)
			}
		}
		catch( Exception e )
		{
			return new PtgErr( PtgErr.ERROR_NUM );
		}

		PtgNumber pnum = new PtgNumber( dec );
		log.debug( "Result from BIN2DEC= " + pnum.getVal() );
		return pnum;
	}