performance - Octal to octal multiplying in Java -


can me multiplying octal octal numbers in java? i'm thinking if user input long octal number multiplied long octal number how result? please show codes. thanks.

result = carry + result; carry = result / 10; numtemp = result % 10; result = result - numtemp; for(int ii = 0; ii < numarray.length; ii++){   numarray[ii] = numarray[ii] / 10; } 

you multiply numbers, not string representations of numbers, octal notation 1 way of representing number.

just parse input int variables, perform multiplication , print out again. (here: formatted in octal representation, can print number in format want)

string num1 = "01234"; string num2 = "04321"; int result = integer.parseint(num1, 8) * integer.parseint(num2, 8); system.out.printf("%#o", result); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -