# Radix 32+ Converter

**URL:** https://discourse.processing.org/t/radix-32-converter/25435
**Category:** Coding Questions
**Created:** [November 15, 2020, 6:32am UTC](https://discourse.processing.org/t/radix-32-converter/25435 "2020-11-15T06:32:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![HumanoidX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humanoidx/32/8506_2.png) [@HumanoidX](https://discourse.processing.org/u/HumanoidX)
#### Post date: [November 15, 2020, 6:32am UTC](https://discourse.processing.org/t/radix-32-converter/25435/1 "2020-11-15T06:32:42Z")

</div>

I want to convert any base to any base.  
I’m using this right now:

```auto
void setup(){
  println(baseConversion("JAVA",36,10));
}

String baseConversion(String input,int fromBase,int toBase){
  return reverseCase(Integer.toString(Integer.parseInt(reverseCase(input),fromBase),toBase));
}

String reverseCase(String text){
  char[] chars = text.toCharArray();
  for(int i = 0; i < chars.length; i++){
    char c = chars[i];
    if(Character.isUpperCase(c)){
      chars[i] = Character.toLowerCase(c);
    }else if(Character.isLowerCase(c)){
      chars[i] = Character.toUpperCase(c);
    }
  }
  return new String(chars);
}

//"PROCESSING" is too large, so I use "JAVA".

```

It only works for radices under 32 now (obviously, the max radix of Java is 32), how can I get it to work for radices over 32, somewhat under 62?

Number list:

```auto
//0
//1
//2
//3
//4
//5
//6
//7
//8
//9
//A
//B
//C
//D
//E
//F
//G
//H
//I
//J
//K
//L
//M
//N
//O
//P
//Q
//R
//S
//T
//U
//V
//W
//X
//Y
//Z
//a
//b
//c
//d
//e
//f
//g
//h
//i
//j
//k
//l
//m
//n
//o
//p
//q
//r
//s
//t
//u
//v
//w
//x
//y
//z
//If you wants more
//`
//~
//!
//@
//#
//$
//%
//^
//&
//*
//(
//)
//-
//_
//=
//+
//[
//{
//]
//}
//\
//|
//etc.

```

---

<div class="post-metadata">

### Author: ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)
#### Post date: [November 15, 2020, 7:59pm UTC](https://discourse.processing.org/t/radix-32-converter/25435/2 "2020-11-15T19:59:51Z")

</div>

Interesting question!  
Are you familiar with how characters are represented on the byte level? If not, look into ASCII encoding and “character algebra”  
Why have that “reverse case” function?

---

<div class="post-metadata">

### Author: ![HumanoidX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humanoidx/32/8506_2.png) [@HumanoidX](https://discourse.processing.org/u/HumanoidX)
#### Post date: [November 16, 2020, 3:09am UTC](https://discourse.processing.org/t/radix-32-converter/25435/3 "2020-11-16T03:09:31Z")

</div>

(My apology for the late reply. Different timeline, I suppose)

> [@tony](#):
>
> Are you familiar with how characters are represented on the byte level?

Yes, I’m familiar with ASCII and Unicode

> [@tony](#):
>
> look into ASCII encoding and “character algebra”

Searching “character algebra” return me “character theory”

> [@tony](#):
>
> Why have that “reverse case” function?

The `reverseCase` is to reverse the output letters (Java radix output lowercase letters).

---

<div class="post-metadata">

### Author: ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)
#### Post date: [November 16, 2020, 4:07am UTC](https://discourse.processing.org/t/radix-32-converter/25435/4 "2020-11-16T04:07:05Z")

</div>

I think you have all the tools, but I can’t help you anymore until you further clarify your problem.

> [@HumanoidX](#):
>
> how can I get it to work for radices over 32, somewhat under 62?

This is just the start of the question. From here you have to start breaking it down. What information does someone else need to know to start helping you. What have you already tried. Wheres the code that is giving you problems?

---

<div class="post-metadata">

### Author: ![HumanoidX](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/humanoidx/32/8506_2.png) [@HumanoidX](https://discourse.processing.org/u/HumanoidX)
#### Post date: [November 17, 2020, 4:03am UTC](https://discourse.processing.org/t/radix-32-converter/25435/5 "2020-11-17T04:03:11Z")

</div>

Never mind, my brain is fooling myself…  
I was trying to find a converter for floating point when I am not needing it at all
