Here is the way, where you can install android OS to Virtual Box in Computer. The Steps are given here
Step 1: Download Requirements.
Virtual Box 
All the following step will also work with VMWare but it will have some different configuration to create hard disk and virtual Machine but if you looking for free software then virtual box is the best one.
Android OS 
From here, you can download an ISO file for android OS. The steps are similar to install any Linux operating system. Because it’s again booting from grub.
Step 2: Install Virtual Box.
Step 3: Create new Virtual machine
Provide name, type and version also create virtual driver now.
Create hard disk configuration, set its size. As the one in figure
go to the setting, to configure ISO file.
Insert android ISO file we downloaded from citation . It is android-X86-XXX.iso in our case.
Now start android Machine.
Once your file boot, you will be a directed to display screen given in screen here. Select 4th option for installation of android in your hard disk.
Create or modify the partition, we will select the first option. And press enter.
Now the new black screen will appear, here we will select [New] tab from bottom.
Again you will have option, select [Primary] from bottom menu.
Provide your hard-disk size, if you’re not quite sure then leave it as it is. Press enter to continue.
Again you will have Menu. Select [Write] from it.
Now, a gray screen will appear which ask for partition we will select EXT2 from it.
Press <YES> to format the disk.
Now it will ask to install boot loader with the name grub (grand unified boot loader). Press <YES> again.
If you’re interested to make some changes after installation in your operating system. Then Press <YES> or <NO>.
Now you’ll see that your installation has been started. Let installation complete.
If your installation done successfully between appear with message given in screen above. Now select run android-x86.
Now, go to the property of virtual Machine and remove ISO file from virtual disk. If you don’t do that it will again ask you for installation. Then reboot your virtual Machine. It will make some configuration with welcome message.
Once the configuration done. It will come again with blue screen given below. Select the first operation press enter and wait for booting your system.
Now it will, ask you to make some configuration like enter your e-mail address and password of Gmail. You may skip it if you want to set this all things later.