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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -