- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Parse and format to arbitrary radix <= Character.MAX_RADIX in Java
Let us set a radix here as.
// radix int r = 32;
Include the radix here as a BigInteger constructor.
BigInteger one = new BigInteger("vv", r);
Now get its string representation −
String strResult = one.toString(radix);
The following is an example −
Example
import java.math.*; public class Demo { public static void main(String[] args) { // radix int r = 32; BigInteger one = new BigInteger("vv", r); String strResult = one.toString(r); System.out.println(strResult); } }
Output
vv
Advertisements