Generate Random Float Type Number in Java

Ankith Reddy
Updated on 29-Jun-2020 06:11:10

4K+ Views

In order to generate Random float type numbers in Java, we use the nextFloat() method of the java.util.Random class. This returns the next random float value between 0.0 (inclusive) and 1.0 (exclusive) from the random generator sequence.Declaration −The java.util.Random.nextFloat() method is declared as follows −public float nextFloat()Let us see a program to generate random float type numbers in Java.Example Live Demoimport java.util.Random; public class Example {    public static void main(String[] args) {       Random rd = new Random(); // creating Random object       System.out.println(rd.nextFloat()); // displaying a random float value between 0.0 and 1.0    } ... Read More

Registers Used in 8259

Chandu yadav
Updated on 29-Jun-2020 06:07:59

3K+ Views

The 8259 is a specialized I/O port chip. It is never used in the interfacing of I/O devices but is only used for controlling the interrupts in a microcomputer.8259 consists of A0 as the only address input pin. Hence for a microprocessor, only two addresses are possible for the 8259 ports. The two ports can be termed as low port and high port.The processor selects the low port when A0 = 0The processor selects the high port when A0 = 1The processor issues some words termed as command words to these ports so as to configure the 8259 better. There are ... Read More

Register Indirect Addressing Mode in 8085 Microprocessor

Ankith Reddy
Updated on 29-Jun-2020 06:01:50

3K+ Views

In this mode, the data is transferred from one register to another by using the address pointed by the register. Register indirect addressing mode also used to call as indirect addressing mode. For example MOV A, M: means data is transferred from the memory address pointed by the register pair HLto the register A.MOV E, MIt occupies only 1-Byte in memory. MOV E, M is an example instruction of this type. It is a 1-Byte instruction. Suppose E register content is DBH, H register content is 40H, and L register content is 50H. Letus say location 4050H has the data ... Read More

Implied Addressing Mode in 8085 Microprocessor

George John
Updated on 29-Jun-2020 06:01:03

2K+ Views

In 8085 Instruction set, there is one mnemonic XCHG, which stands for eXCHanGe. This is an instruction to exchange contents of HL register pair with DE register pair. This instruction uses implied addressing mode. In the instruction, we don’t mention as “XCHG HL, DE”. It is implied that it will deal with HL and DEregister pairs. So we write only XCHG as mnemonic. That’s why it is called an implied addressing mode. As it is 1-Byte instruction, so It occupies only 1-Byte in the memory. After execution of this instruction, the content between H and D registers and L and ... Read More

Overview of the Working of 8259

Arjun Thakur
Updated on 29-Jun-2020 05:58:29

2K+ Views

The interrupt requests are accepted by 8259 from many interrupting devices IR0 to IR7  pins. After that, it identifies the highest priority interrupt request from those inputs that are already active. To configure the 8259 for fixed priority mode of operation, among them IR0 has the highest and IR7 has the lowest priority. If the inputs IR2, IR4, and IR6 are active, thenIR2 has the highest priority interrupt request among the active requests than the other. The details of the interrupt requests those are active are stored in the Interrupt Request Register (IRR).By loading the Interrupt Mask Register (IMR), it ... Read More

Architecture of 8259

Ankith Reddy
Updated on 29-Jun-2020 05:53:02

5K+ Views

8259 Microprocessor is architected in a unique style. It can program by means of some interrupts conditions by means of level or interrupt level often called edge-triggered interrupt level. Masking is done to individual interrupt bits. As the number of 8259 increases interrupt pins up to 64 can be obtained. There are 3 registers 8259 contains along with one priority resolver(PR). They are as follows −Interrupt Request Register(IIR)  − It stores the bits who requests the interrupt.Interrupt service register(ISR) − It stores the currently interrupt levels.Interrupt Mask Register(IMR)  − Stores the interrupt levels to be masked.PriorityResolver(PR)  − Set the priority of ... Read More

Understanding the Pins of 8259

George John
Updated on 29-Jun-2020 05:52:04

6K+ Views

Intel 8259 is designed as a 28-pin-programmable IC available as a package named DIP (Dual inline package). Its physical and functional pin diagrams are indicated below.PIN NameDescription and PurposesVcc and GndIt is the Power supply and ground pins. +5V power supply isused in this chip.D7-0For communication with the processor, there are Eight bi-directional data pins.RD*It is active low-input pin activated by the processor to read the information status from the 8259.WR*It is an active low-input pin which is activated by the processor to write the control information to  8259.CS*For selecting the chip it is used an active low input pin.A0An ... Read More

Format Month in MM Format in Java

Samual Sam
Updated on 29-Jun-2020 05:50:56

1K+ Views

The MM format is for months in two-digits 01, 02, 03, 04, etc. Here, we will use the following.SimpleDateFormat("MM");Let us see an example −// displaying month in MM format SimpleDateFormat simpleformat = new SimpleDateFormat("MM"); String strMonth = simpleformat.format(new Date()); System.out.println("Month in MM format = "+strMonth)Above, we have used the SimpleDateFormat class, therefore the following package is imported −import java.text.SimpleDateFormat;The following is an example −Example Live Demoimport java.text.Format; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class Demo {    public static void main(String[] args) throws Exception {       // displaying current date and time       Calendar cal = ... Read More

Retrieve Current Bits in Byte Array in Two's Complement Form

karthikeya Boyini
Updated on 29-Jun-2020 05:49:20

308 Views

Use the toByteArray() method to return a byte array containing the two's-complement representation of this BigInteger. The byte array will be in big-endian byte-order: the most significant byte is in the zeroth element.The following is an example to retrieve the current bits in a byte array in two’s-complement form.Example Live Demoimport java.math.*; public class Demo {    public static void main(String[] args) {       // BigInteger objects       BigInteger bi1, bi2;       byte b1[] = { 0x1, 0x00, 0x00 };       bi1 = new BigInteger(b1);       b1 = bi1.toByteArray();     ... Read More

Parse Octal String to Create BigInteger in Java

Samual Sam
Updated on 29-Jun-2020 05:48:05

179 Views

To parse the octal string to create BigInteger, use the following BigInteger constructor and set the radix as 8 for Octal −BigInteger(String val, int radix)This constructor is used to translate the String representation of a BigInteger in the specified radix into a BigInteger.In the below example, we have set the BigInteger and radix is set as 8.BigInteger one, two; one = new BigInteger("12"); two = new BigInteger("4373427", 8);The following is the complete example −Example Live Demoimport java.math.*; public class Demo {    public static void main(String[] args) {       BigInteger one, two;       one = new BigInteger("12"); ... Read More

Advertisements