public static void div() { long a = getLong(GprA0, GprA1); long b = getLong(GprA2, GprA3); long result; if (a >= 0 && b >= 0) { // If both operands are positive, we can use normal "long" arithmetic result = a / b; } else { // If one of the operands is negative, we have to use BigInteger arithmetic. // Only BigInteger handles correctly value above 0x80000000000 // Input bytes for BigInteger are assumed to be in big-endian byte-order. //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'sealed override': //ORIGINAL LINE: sealed override byte[] bytesA = new byte[8]; sbyte[] bytesA = new sbyte[8]; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'sealed override': //ORIGINAL LINE: sealed override byte[] bytesB = new byte[8]; sbyte[] bytesB = new sbyte[8]; for (int i = 7; i >= 0; i--) { bytesA[i] = (sbyte)a; bytesB[i] = (sbyte)b; a >>= 8; b >>= 8; } // Create positive BigInteger values, the signum is always 1 for positive values. System.Numerics.BigInteger bigA = new BigInteger(1, bytesA); System.Numerics.BigInteger bigB = new BigInteger(1, bytesB); // Compute the division System.Numerics.BigInteger bigResult = bigA / bigB; // and convert the result to a long value. result = bigResult.longValue(); } GprV0V1 = result; }