Octal To Decimal

This algorithm converts octal numbers to decimal numbers.



									public static int OctalToDecimal(string octal)
{
	int octLength = octal.Length;
	double dec = 0;

	for (int i = 0; i < octLength; ++i)
	{
		dec += ((byte)octal[i] - 48) * Math.Pow(8, ((octLength - i) - 1));
	}

	return (int)dec;
}
								


Example

									string data = "2430357";
int value = OctalToDecimal(data);
								


Output

									667887