android - decimal to char coding -


I am trying to convert a decimal to a character. I have my alphabet which has been converted to a four array.

  string alphabet = "abcdefghijklmnopqrstuvwxyz"; Alpha = alphabet Cochrane ();  

I was using a binary number, so there is a value of only 0 to 255, but when I try to execute this code it does not work.

  Private int ToChar {int encryptcode} {int base = 26; Intro character space = (encrypted code / 255) * base; Four letter = alpha [character post]; Return character; I have to say that the decimal number 78, 78/255 * 26 7.95 (8 to the int round) should be seen, it should look alpha array and give 'h'. But each character gives the meaning 'A', which means that  (encrypted code / 255) * base  is not working with purpose.   

Kevin is in the right comment, try to rearrange your thread like this:

  int characterSteps = (encryptCode * base) / 255;  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -