Sorting random numbers using Bubble Sort

Hi Friends,

Here is a sample program to sort some random numbers using bubble sort

Feel free to comment if you have any doubt.

If you like please share and subscribe. 🙂

Advertisements

Swapping two variables in One Line

Hi friends,

Recently i was there in a situation where in i needed to swap the values rather using the traditional way.

Following is the small java program which will give you the idea:

If you don’t like bitwise operations u can use following program

 

Feel free to comment if you have any doubts and share if like. 🙂

 

Project Euler #1: Multiples of 3 and 5

Hi Friends ,

From today onwards I will be solving problems based on the Project Euler.

You can access the site from here. Today is the First Problem of Euler.

Find the sum of all the multiples of 3 or 5 .

Input Format

First line contains T that denotes the number of test cases. This is followed by T lines, each containing an integer,  N

Output Format

For each test case, print an integer that denotes the sum of all the multiples of 3 or 5 below N .

So here is the code of the first problem :

 

Feel free to comment.

 

 

 

 

Send Emails through JSP(Java server Page)

Hi , Every one Today we are going to learn a simple jsp code to send email .

There might me n no. of situations where in you may require to a page where in you need to send email.

Following code might save you

To achieve this we require two libraries

  1. mail-1.4.1.jar
  2. activation-1.1.1.jar

I’ll leave the links below so you download them.

So the code

The code itself is self explanatory.
Just insert the

  • authAddress with the sender email id
  • authPassword with the sender password
  • smtpServer with your smtp server address
  • smtpPort    with your smtp server port
  • subject   with subject for your email
  • email    with the receiver email address

And run , it will start shooting emails as you click on Send

You can download both the JAR from the GitHub Link.

Else you can clone the Project

git clone https://github.com/ShubhamS32/JSPMailer.git

Feel free to comment 🙂