Posts

Showing posts from April, 2013

How to Convert from binary to hex in java

Simple One line code to convert  String containing a binary value to Hex String bin = Integer . toHexString ( Integer . parseInt ( binOutput , 2 )); Full Code for conversion import java.io.* ; import java.lang.* ; public class BinaryToHexadecimal { public static void main ( String [] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in )); System . out . println ( "Enter the Binary number:" ); String hex = bf . readLine (); long num = Long . parseLong ( hex ); long rem ; while ( num > 0 ){ rem = num % 10 ; num = num / 10 ; if ( rem != 0 && rem != 1 ){ System . out . println ( "This is not a binary number." ); System . out . println ( "Please try once again." ); System . exit ( 0 ); } } int i = Integer . parseInt ( hex , 2 ); String hexString = Integer . toHexString ( i ); System . out . println ( "Hexa decima...

How to convert binary value to decimal in Java

How to convert binary to decimal in java public static int integerfrmbinary ( String str ){ double j = 0 ; for ( int i = 0 ; i < str . length (); i ++){ if ( str . charAt ( i )== '1' ){ j = j + Math . pow ( 2 , str . length ()- 1 - i ); } } return ( int ) j ; } -------------------------------------------------------------------------------------- Other Way: import java.lang.* ; import java.io.* ; public class BinaryToDecimal { public static void main ( String [] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in )); System . out . print ( "Enter the Binary value: " ); String str = bf . readLine (); long num = Long . parseLong ( str ); long rem ; while ( num > 0 ){ rem = num % 10 ; num = num / 10 ; if ( rem != 0 && rem != 1 ){ System . out . println ( "This is not a binary number." ); ...

Decimal to Hexadecimal Converter in Java

Convert decimal integer to hexadecimal number example import java.io.* ; import java.lang.* ; public class DecimalToHexadecimal { public static void main ( String [] args ) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in )); System . out . println ( "Enter the decimal value:" ); String hex = bf . readLine (); int i = Integer . parseInt ( hex ); String hex1 = Integer . toHexString ( i ); System . out . println ( "Hexa decimal: " + hex1 ); } } run: Enter the decimal value: 16 Hexa decimal: 10 -------------------------------------------------------- hex - Decimal to Hexadecimal Converter in Java Java Convert integer to hex integer Converting to/from hexadecimal in Java Can someone give me a java code how to convert decimal to How to convert decimal to hex using a do-while, while Hexadecimal To Decimal Java Conversion Doesn't Java program to convert hexadecimal number to Ja...

Convert Decimal to Octal in Java

convert decimal number octal java import java.io.* ; import java.lang.* ; public class DecimalToOctal { public static void main ( String [] args ) throws IOException { BufferedReader buff = new BufferedReader ( new InputStreamReader ( System . in )); System . out . println ( "Enter the decimal number:" ); String deci = buff . readLine (); int value = Integer . parseInt ( deci ); String str = Integer . toString ( value , 8 ); System . out . println ( "octal:=" + str ); } } run: Enter the decimal number: 16 octal:=20 ------------------------------------------------------ java - Decimal to Octal Conversion Converting Decimal to Binary Java built-in Java classes/methods to convert between binary, decimal Convert Decimal to Octal,Decimal to Octal Conversion,Decimal to How do i convert a decimal number to octal? Help With Decimal To Octal Conversion - Java Converting Decimal To Octal In Vim - Java Convert Decimal Number To Octal ...

Convert Decimal into Binary in Java

Converting decimal to binary in Java import java.lang.* ; import java.io.* ; public class DecimalToBinary { public static void main ( String args []) throws IOException { BufferedReader bf = new BufferedReader ( new InputStreamReader ( System . in )); System . out . println ( "Enter the decimal value:" ); String hex = bf . readLine (); int i = Integer . parseInt ( hex ); String by = Integer . toBinaryString ( i ); System . out . println ( "Binary: " + by ); } } run: Enter the decimal value: 10 Binary: 1010 BUILD SUCCESSFUL (total time: 9 seconds) Other Way : public class NumberConverter { public static void main ( String [] args ) { int i = Integer . parseInt ( args [ 0 ]); toBinary ( i ); } public static void toBinary ( int int1 ){ System . out . println ( int1 + " in binary is" ); System . out . println ( Integer . toBinaryString ( int1 )); } } --------...

C++ Program To Count Upper, Lowercase, Numbers, Characters

#include <iostream> #include <iomanip> using namespace std ; int main () { // declare variables int numUpperCase = 0 ; int numVowel = 0 ; int numChars = 0 ; char character = ' ' ; cout << "Enter a sentence: " ; // Get sentence from user utilizing while loop while ( cin >> character && character != '.' ) { // Checks to see if inputted data is UPPERCASE if (( character >= 'A' ) && ( character <= 'Z' )) { ++ numUpperCase ; // Increments Total number of uppercase by one } // Checks to see if inputted data is a vowel if (( character == 'a' ) || ( character == 'A' ) || ( character == 'e' ) || ( character == 'E' ) || ( character == 'i' ) || ( character == 'I' ) || ( character == 'o' ) || ( character == 'O' ) || ( character == 'u...

C++

C++ Tutorials C++ Calculator Program - Source Code C++ program Fibonacci series C++ program to find prime numbers in a given range C++ PROGRAM TO CHECK WHETHER A NUMBER IS A PERFECT NUMBER Write a C++ program to Solve Quadratic equation Compiling Crypto++ library into the Microsoft Visual C++ Environment + Running Sample program

C#

C# C# Tutorial 1:Getting Started and Mysql database Connection C# Tutorial 2:Create Login Form with MySql C# Tutorial 3: Password Protection using Textbox C# Tutorial 4: Add pictures and icons in Frame C# Tutorial 5: How To Open A Second Form C# Tutorial 6: Insert/Save data to database C# Tutorial 7: Edit/Update a data from Database with button C# Tutorial 8: Deleting selected data from database C# Tutorial 9: How to Use a Combo box C# Tutorial 10: How to Link Combobox with Database values C# Tutorial 11:Database values in textbox if select Combobox C# Tutorial 12: How to Link List Box with Database and show values in textbox if select ListBox C# Tutorial 13:Show database values in Table or DataGridView C# Tutorial 14:How to use Chart /Graph in Visual C# C# Tutorial 15: How to Link Chart /Graph with Database C# Tutorial 16: Dynamically Display (Running) Current Date Time C# Tutorial 17: How to use Progress Bar and Button C# Tutorial 18: How to gracefully exit this application...

VirtualBox Ubuntu

VirtualBox Ubuntu Install Linux ubuntu 12.10 on virtualbox in windows 7 Installing Eclipse IDE in Linux Ubuntu 12.10 How to Install nginx server on Ubuntu How to compile and run C program in ubuntu using gcc Increase screen resolution for Ubuntu when using VirtualBox How to Share Folders in Ubuntu Guest with Windows 7 Host using VirtualBox Build and Run Sample Code for Log4Cpp C++ library from Source Code on Ubuntu Install eclipse cdt plugin for C/C++ Program in Eclipse IDE for Ubuntu Linux Install MongoDB on Ubuntu

Visual C++ Windows Forms Application Tutorial

Visual C++ Windows Forms Application Tutorial Visual C++ Tutorial 1 -Windows Forms Application: Getting Started Hello World Free Install Visual C++ Tutorial 2 -Windows Forms Application: Mysql Connection Part 1 Visual C++ Tutorial 3 -Windows Forms Application: Mysql Connection Part 2 Visual C++ Tutorial 4 -Windows Forms Application: Create Login Form with MySql Part 1 Visual C++ Tutorial 5 -Windows Forms Application: Create Login Form with MySql Part 2 Visual C++ Tutorial 6 -Windows Forms Application: How To Open A Second Form Visual C++ Tutorial 7 -Windows Forms Application: Add pictures and icons in Frame Visual C++ Tutorial 8 -Windows Forms Application: Password Protection using Textbox Visual C++ Tutorial 9 -Windows Forms Application: Insert/Save data to database Part 1 Visual C++ Tutorial 10 -Windows Forms Application: Insert/Save data to database Part 2 Visual C++ Tutorial 11 -Windows Forms Application: How to Use a Combo box Visual C++ Tutorial 12 -Windows Forms Application: How...

Webdesign Weebly

Webdesign Weebly Webdesign#1: Weebly: How to make a website for free , Make a Free Website Webdesign#2: Weebly: Make a Free Website: getting familiar with toolbar Webdesign#3: Weebly: Make a Free Website: Customize Header image Webdesign#4: Weebly: Make a Free Website: Add Video to website Webdesign#5: Weebly: Make a Free Website: Add social media to website + New Page Webdesign#6: Weebly: Make a Free Website: Add Playlist website + New Page Webdesign#7: Weebly: Make a Free Website: Add custom html codes Part1 Webdesign#8: Weebly: Make a Free Website: Add custom html codes Part2 Webdesign#9: Weebly: Make a Free Website: Add Contact Form